Skip to content

Commit 65a30a2

Browse files
authored
Fix minor resolve_binary feature flag issues. (#3737)
## Motivation `resolve_binary` doesn't strip the `dep` directory if it isn't built `with_testing`. This causes some tests to fail if they are run locally in isolation. (In CI, since they are being run together with the other tests, they _do_ use `linera-base/test`, so this doesn't cause issues.) Also, `test_resolve_binary` is needlessly behind feature flags. ## Proposal Make test dependencies explicit and move `test_resolve_binary` to the `local` tests. ## Test Plan It fixed e.g. `cargo test -p linera-indexer-graphql-client` for me locally, and makes `cargo test -p linera-service test_resolve_binary` actually run the test. ## Release Plan - Nothing to do / These changes follow the usual release cycle. ## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent b0a794a commit 65a30a2

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

linera-indexer/example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tracing-subscriber = { workspace = true, features = ["fmt"] }
3434
[dev-dependencies]
3535
anyhow.workspace = true
3636
async-graphql.workspace = true
37-
linera-base.workspace = true
37+
linera-base = { workspace = true, features = ["test"] }
3838
linera-indexer-graphql-client.workspace = true
3939
linera-service = { workspace = true, features = ["rocksdb", "test"] }
4040
linera-service-graphql-client.workspace = true

linera-indexer/graphql-client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ serde_json.workspace = true
2121
linera-execution.workspace = true
2222

2323
[dev-dependencies]
24+
linera-base = { workspace = true, features = ["test"] }
2425
linera-service.workspace = true
2526
tempfile.workspace = true
2627
test-log = { workspace = true, features = ["trace"] }

linera-service-graphql-client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ linera-execution.workspace = true
3333

3434
[dev-dependencies]
3535
fungible.workspace = true
36+
linera-base = { workspace = true, features = ["test"] }
3637
linera-service = { workspace = true, features = ["test"] }
3738
tempfile.workspace = true
3839
test-case.workspace = true

linera-service/tests/linera_net_tests.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use futures::{
2626
};
2727
use guard::INTEGRATION_TEST_GUARD;
2828
use linera_base::{
29-
command::resolve_binary,
3029
crypto::CryptoHash,
3130
data_types::Amount,
3231
identifiers::{Account, AccountOwner, ApplicationId, ChainId},
@@ -2475,17 +2474,6 @@ async fn test_wasm_end_to_end_amm(config: impl LineraNetConfig) -> Result<()> {
24752474
Ok(())
24762475
}
24772476

2478-
#[test_log::test(tokio::test)]
2479-
async fn test_resolve_binary() -> Result<()> {
2480-
resolve_binary("linera", env!("CARGO_PKG_NAME")).await?;
2481-
resolve_binary("linera-proxy", env!("CARGO_PKG_NAME")).await?;
2482-
assert!(resolve_binary("linera-spaceship", env!("CARGO_PKG_NAME"))
2483-
.await
2484-
.is_err());
2485-
2486-
Ok(())
2487-
}
2488-
24892477
#[cfg_attr(feature = "storage-service", test_case(LocalNetConfig::new_test(Database::Service, Network::Grpc) ; "storage_test_service_grpc"))]
24902478
#[cfg_attr(feature = "scylladb", test_case(LocalNetConfig::new_test(Database::ScyllaDb, Network::Grpc) ; "scylladb_grpc"))]
24912479
#[cfg_attr(feature = "dynamodb", test_case(LocalNetConfig::new_test(Database::DynamoDb, Network::Grpc) ; "aws_grpc"))]
@@ -3015,7 +3003,8 @@ async fn test_end_to_end_fungible_client_benchmark(config: impl LineraNetConfig)
30153003
let mut faucet_service = client1.run_faucet(None, chain1, Amount::ONE).await?;
30163004
let faucet = faucet_service.instance();
30173005

3018-
let path = resolve_binary("linera-benchmark", env!("CARGO_PKG_NAME")).await?;
3006+
let path =
3007+
linera_base::command::resolve_binary("linera-benchmark", env!("CARGO_PKG_NAME")).await?;
30193008
// The benchmark looks for examples/fungible, so it needs to run in the project root.
30203009
let current_dir = std::env::current_exe()?;
30213010
let dir = current_dir.ancestors().nth(4).unwrap();

linera-service/tests/local.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use std::{path::PathBuf, process::Command};
55

66
use anyhow::Result;
7+
use linera_base::command::resolve_binary;
78
use linera_service::cli_wrappers::{local_net::PathProvider, ClientWrapper, Network, OnClientDrop};
89

910
mod common;
@@ -62,3 +63,14 @@ async fn test_project_test() -> Result<()> {
6263

6364
Ok(())
6465
}
66+
67+
#[test_log::test(tokio::test)]
68+
async fn test_resolve_binary() -> Result<()> {
69+
resolve_binary("linera", env!("CARGO_PKG_NAME")).await?;
70+
resolve_binary("linera-proxy", env!("CARGO_PKG_NAME")).await?;
71+
assert!(resolve_binary("linera-spaceship", env!("CARGO_PKG_NAME"))
72+
.await
73+
.is_err());
74+
75+
Ok(())
76+
}

0 commit comments

Comments
 (0)