Skip to content

Commit

Permalink
Bump nontrivial Rust dependencies (#1402)
Browse files Browse the repository at this point in the history
- Update mock_clock
- Update tower
- Update tokio-rustls
- Remove the direct dependency on once_cell, as the functionality is now
  part of the standard library.
- Partially update the opentelemetry stack. A full upgrade is not yet
  possible as opentelemetry-prometheus relies on an outdated version.
  • Loading branch information
aaronmondal authored Oct 10, 2024
1 parent d602746 commit f541cbb
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 159 deletions.
219 changes: 90 additions & 129 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ rustls-pemfile = { version = "2.2.0", default-features = false }
scopeguard = { version = "1.2.0", default-features = false }
serde_json5 = "0.1.0"
tokio = { version = "1.40.0", features = ["fs", "rt-multi-thread", "signal", "io-util"], default-features = false }
tokio-rustls = { version = "0.25.0", default-features = false, features = [
tokio-rustls = { version = "0.26.0", default-features = false, features = [
"ring",
] }
tonic = { version = "0.12.3", features = ["transport", "tls"], default-features = false }
tower = { version = "0.4.13", default-features = false }
tower = { version = "0.5.1", default-features = false }
tracing = { version = "0.1.40", default-features = false }
opentelemetry_sdk = { version = "0.23.0", default-features = false }
opentelemetry_sdk = { version = "0.24.1", default-features = false }
tracing-subscriber = { version = "0.3.18", default-features = false }
opentelemetry = { version = "0.23.0", default-features = false }
opentelemetry = { version = "0.24.0", default-features = false }
prometheus = { version = "0.13.4", default-features = false }
opentelemetry-prometheus = "0.16.0"
opentelemetry-prometheus = "0.17.0"
serde_json = "1.0.128"

[workspace.cargo-features-manager.keep]
Expand Down
6 changes: 3 additions & 3 deletions nativelink-metric-collector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ rust-version = "1.79.0"

[dependencies]
nativelink-metric = { path = "../nativelink-metric" }
opentelemetry = { version = "0.23.0", default-features = false }
opentelemetry = { version = "0.24.0", default-features = false }
parking_lot = "0.12.3"
serde = { version = "1.0.210", default-features = false }
tracing = { version = "0.1.40", default-features = false }
tracing-subscriber = { version = "0.3.18", default-features = false }

[dev-dependencies]
nativelink-error = { path = "../nativelink-error" }
opentelemetry_sdk = { version = "0.23.0", default-features = false }
opentelemetry-prometheus = "0.16.0"
opentelemetry_sdk = { version = "0.24.1", default-features = false }
opentelemetry-prometheus = "0.17.0"
prometheus = { version = "0.13.4", default-features = false }
serde_json = { version = "1.0.128", default-features = false }
2 changes: 1 addition & 1 deletion nativelink-metric-collector/tests/metric_collector_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ fn test_prometheus_exporter() -> Result<(), Error> {
nativelink_custom_handler_num_counter 6
nativelink_foo_custom_handler_num_counter 4
nativelink_pub_u64 1
target_info{service_name="unknown_service",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="0.23.0"} 1
target_info{service_name="unknown_service",telemetry_sdk_language="rust",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="0.24.1"} 1
"#.trim()).lines().map(|v| v.unwrap()).collect();

// We need to sort because the output order is non-deterministic.
Expand Down
2 changes: 1 addition & 1 deletion nativelink-scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ prost = { version = "0.13.3", default-features = false }
uuid = { version = "1.10.0", default-features = false, features = ["v4", "serde"] }
futures = { version = "0.3.30", default-features = false }
lru = { version = "0.12.4", default-features = false }
mock_instant = "0.3.2"
mock_instant = "0.5.1"
parking_lot = "0.12.3"
rand = { version = "0.8.5", default-features = false }
scopeguard = { version = "1.2.0", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use fred::error::{RedisError, RedisErrorKind};
use fred::mocks::{MockCommand, Mocks};
use fred::prelude::Builder;
use fred::types::{RedisConfig, RedisValue};
use mock_instant::SystemTime as MockSystemTime;
use mock_instant::thread_local::SystemTime as MockSystemTime;
use nativelink_error::Error;
use nativelink_macro::nativelink_test;
use nativelink_scheduler::awaited_action_db::{
Expand Down
2 changes: 1 addition & 1 deletion nativelink-scheduler/tests/simple_scheduler_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
use async_lock::Mutex;
use futures::task::Poll;
use futures::{poll, Stream, StreamExt};
use mock_instant::{MockClock, SystemTime as MockSystemTime};
use mock_instant::thread_local::{MockClock, SystemTime as MockSystemTime};
use nativelink_config::schedulers::PropertyType;
use nativelink_error::{make_err, Code, Error, ResultExt};
use nativelink_macro::nativelink_test;
Expand Down
2 changes: 1 addition & 1 deletion nativelink-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ prost = { version = "0.13.3", default-features = false }
tokio = { version = "1.40.0", features = ["fs", "rt-multi-thread", "signal", "io-util"], default-features = false }
tokio-stream = { version = "0.1.16", features = ["fs"], default-features = false }
tonic = { version = "0.12.3", features = ["transport", "tls"], default-features = false }
tower = { version = "0.4.13", default-features = false }
tower = { version = "0.5.1", default-features = false }
tracing = { version = "0.1.40", default-features = false }
uuid = { version = "1.10.0", default-features = false, features = ["v4", "serde"] }

Expand Down
1 change: 0 additions & 1 deletion nativelink-store/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ rust_test_suite(
"@crates//:hyper-0.14.30",
"@crates//:memory-stats",
"@crates//:mock_instant",
"@crates//:once_cell",
"@crates//:parking_lot",
"@crates//:pretty_assertions",
"@crates//:rand",
Expand Down
3 changes: 1 addition & 2 deletions nativelink-store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ nativelink-macro = { path = "../nativelink-macro" }
nativelink-metric-collector = { path = "../nativelink-metric-collector" }
pretty_assertions = { version = "1.4.1", features = ["std"] }
memory-stats = "1.2.0"
mock_instant = "0.3.2"
once_cell = { version = "1.20.1", default-features = false }
mock_instant = "0.5.1"
sha2 = { version = "0.10.8", default-features = false }
http = { version = "1.1.0", default-features = false }
aws-smithy-types = "1.2.7"
Expand Down
2 changes: 1 addition & 1 deletion nativelink-store/tests/existence_store_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use std::time::Duration;

use mock_instant::MockClock;
use mock_instant::thread_local::MockClock;
use nativelink_config::stores::{
EvictionPolicy, ExistenceCacheStore as ExistenceCacheStoreConfig, StoreConfig,
};
Expand Down
9 changes: 5 additions & 4 deletions nativelink-store/tests/filesystem_store_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::marker::PhantomData;
use std::ops::DerefMut;
use std::path::Path;
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use std::sync::Arc;
use std::sync::{Arc, LazyLock};
use std::time::{Duration, SystemTime};

use async_lock::RwLock;
Expand All @@ -40,7 +40,6 @@ use nativelink_util::evicting_map::LenEntry;
use nativelink_util::origin_context::ContextAwareFuture;
use nativelink_util::store_trait::{Store, StoreLike, UploadSizeInfo};
use nativelink_util::{background_spawn, spawn};
use once_cell::sync::Lazy;
use parking_lot::Mutex;
use pretty_assertions::assert_eq;
use rand::{thread_rng, Rng};
Expand Down Expand Up @@ -803,7 +802,8 @@ async fn eviction_on_insert_calls_unref_once() -> Result<(), Error> {
let small_digest = DigestInfo::try_new(HASH1, SMALL_VALUE.len())?;
let big_digest = DigestInfo::try_new(HASH1, BIG_VALUE.len())?;

static UNREFED_DIGESTS: Lazy<Mutex<Vec<DigestInfo>>> = Lazy::new(|| Mutex::new(Vec::new()));
static UNREFED_DIGESTS: LazyLock<Mutex<Vec<DigestInfo>>> =
LazyLock::new(|| Mutex::new(Vec::new()));
struct LocalHooks {}
impl FileEntryHooks for LocalHooks {
fn on_unref<Fe: FileEntry>(file_entry: &Fe) {
Expand Down Expand Up @@ -863,7 +863,8 @@ async fn rename_on_insert_fails_due_to_filesystem_error_proper_cleanup_happens()
let content_path = make_temp_path("content_path");
let temp_path = make_temp_path("temp_path");

static FILE_DELETED_BARRIER: Lazy<Arc<Barrier>> = Lazy::new(|| Arc::new(Barrier::new(2)));
static FILE_DELETED_BARRIER: LazyLock<Arc<Barrier>> =
LazyLock::new(|| Arc::new(Barrier::new(2)));

struct LocalHooks {}
impl FileEntryHooks for LocalHooks {
Expand Down
2 changes: 1 addition & 1 deletion nativelink-store/tests/s3_store_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use futures::task::Poll;
use http::header;
use http::status::StatusCode;
use hyper::Body;
use mock_instant::MockClock;
use mock_instant::thread_local::MockClock;
use nativelink_error::{make_input_err, Error, ResultExt};
use nativelink_macro::nativelink_test;
use nativelink_store::s3_store::S3Store;
Expand Down
2 changes: 1 addition & 1 deletion nativelink-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tonic = { version = "0.12.3", features = ["transport", "tls"], default-features
tracing = { version = "0.1.40", default-features = false }
tracing-subscriber = { version = "0.3.18", features = ["ansi", "env-filter", "json"], default-features = false }
uuid = { version = "1.10.0", default-features = false, features = ["v4", "serde"] }
mock_instant = "0.3.2"
mock_instant = "0.5.1"

[dev-dependencies]
nativelink-macro = { path = "../nativelink-macro" }
Expand Down
2 changes: 1 addition & 1 deletion nativelink-util/src/instant_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use std::future::Future;
use std::time::{Duration, SystemTime, UNIX_EPOCH};

use mock_instant::{Instant as MockInstant, MockClock};
use mock_instant::thread_local::{Instant as MockInstant, MockClock};

/// Wrapper used to abstract away which underlying Instant impl we are using.
/// This is needed for testing.
Expand Down
2 changes: 1 addition & 1 deletion nativelink-util/tests/evicting_map_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::Arc;
use std::time::Duration;

use bytes::Bytes;
use mock_instant::MockClock;
use mock_instant::thread_local::MockClock;
use nativelink_config::stores::EvictionPolicy;
use nativelink_error::Error;
use nativelink_macro::nativelink_test;
Expand Down
1 change: 0 additions & 1 deletion nativelink-worker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ rust_test_suite(
"@crates//:bytes",
"@crates//:futures",
"@crates//:hyper-1.4.1",
"@crates//:once_cell",
"@crates//:pin-project-lite",
"@crates//:pretty_assertions",
"@crates//:prost",
Expand Down
1 change: 0 additions & 1 deletion nativelink-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ nativelink-macro = { path = "../nativelink-macro" }

hyper = "1.4.1"
hyper-util = "0.1.9"
once_cell = { version = "1.20.1", default-features = false }
pretty_assertions = { version = "1.4.1", features = ["std"] }
prost-types = { version = "0.13.3", default-features = false }
rand = { version = "0.8.5", default-features = false }
5 changes: 2 additions & 3 deletions nativelink-worker/tests/running_actions_manager_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::io::{Cursor, Write};
use std::os::unix::fs::{MetadataExt, PermissionsExt};
use std::str::from_utf8;
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, Ordering};
use std::sync::{Arc, Mutex};
use std::sync::{Arc, LazyLock, Mutex};
use std::time::{Duration, SystemTime, UNIX_EPOCH};

use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt};
Expand Down Expand Up @@ -54,7 +54,6 @@ use nativelink_worker::running_actions_manager::{
download_to_directory, Callbacks, ExecutionConfiguration, RunningAction, RunningActionImpl,
RunningActionsManager, RunningActionsManagerArgs, RunningActionsManagerImpl,
};
use once_cell::sync::Lazy;
use pretty_assertions::assert_eq;
use prost::Message;
use rand::{thread_rng, Rng};
Expand Down Expand Up @@ -2568,7 +2567,7 @@ async fn worker_times_out() -> Result<(), Box<dyn std::error::Error>> {
}

type StaticOneshotTuple = Mutex<(Option<oneshot::Sender<()>>, Option<oneshot::Receiver<()>>)>;
static TIMEOUT_ONESHOT: Lazy<StaticOneshotTuple> = Lazy::new(|| {
static TIMEOUT_ONESHOT: LazyLock<StaticOneshotTuple> = LazyLock::new(|| {
let (tx, rx) = oneshot::channel();
Mutex::new((Some(tx), Some(rx)))
});
Expand Down

0 comments on commit f541cbb

Please sign in to comment.