Skip to content

Commit

Permalink
chore: remove unnecessary deps and add tooling for those checks
Browse files Browse the repository at this point in the history
Includes:

- [X] correct use of serial_test create (serial vs parallel) for cargo test (not nextest) tests for the few we have
- [X] file cleanup
  • Loading branch information
zeeshanlakhani committed Jan 30, 2024
1 parent 0b07985 commit 9a81e45
Show file tree
Hide file tree
Showing 24 changed files with 90 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0

jobs:
binary-builds:
if: >
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0

jobs:
release-plz:
if: >
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/tests_and_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ jobs:
if: ${{ needs.changes.outputs.rust == 'true' }}
env:
RUSTFLAGS: -Dwarnings -Ctarget-feature=+crt-static
CARGO_INCREMENTAL: 0
strategy:
fail-fast: false
matrix:
Expand Down
3 changes: 0 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file removed examples/.gitkeep
Empty file.
7 changes: 6 additions & 1 deletion examples/websocket-relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"
publish = false

[dependencies]
clap = "4.4"
homestar-runtime = { path = "../../homestar-runtime", default-features = false, features = [
"ansi-logs",
"ipfs",
Expand All @@ -24,3 +23,9 @@ name = "example-websocket-relay"
path = "src/main.rs"
doc = false
test = false

[package.metadata.cargo-machete]
ignored = ["homestar-workspace-hack"]

[package.metadata.cargo-udeps.ignore]
normal = ["homestar-workspace-hack"]
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
cargo-cross
cargo-expand
cargo-hakari
cargo-machete
cargo-nextest
cargo-sort
cargo-unused-features
Expand Down
6 changes: 6 additions & 0 deletions homestar-functions/add/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ crate-type = ["cdylib"]

[features]
default = []

[package.metadata.cargo-machete]
ignored = ["homestar-workspace-hack"]

[package.metadata.cargo-udeps.ignore]
normal = ["homestar-workspace-hack"]
6 changes: 6 additions & 0 deletions homestar-functions/test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ crate-type = ["cdylib"]
[features]
default = []
run-image-tests = []

[package.metadata.cargo-machete]
ignored = ["homestar-workspace-hack"]

[package.metadata.cargo-udeps.ignore]
normal = ["homestar-workspace-hack"]
6 changes: 6 additions & 0 deletions homestar-invocation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ test-utils = []
all-features = true
# defines the configuration attribute `docsrs`
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.cargo-machete]
ignored = ["homestar-workspace-hack", "libsqlite3-sys"]

[package.metadata.cargo-udeps.ignore]
normal = ["homestar-workspace-hack", "libsqlite3-sys"]
6 changes: 6 additions & 0 deletions homestar-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,9 @@ assets = [
{ source = "../LICENSE", dest = "/usr/share/doc/homestar/LICENSE.md", mode = "644", doc = true },
{ source = "../README.md", dest = "/usr/share/doc/homestar/README.md", mode = "644", doc = true },
]

[package.metadata.cargo-machete]
ignored = ["homestar-workspace-hack", "libsqlite3-sys", "puffin", "puffin_egui"]

[package.metadata.cargo-udeps.ignore]
normal = ["homestar-workspace-hack", "libsqlite3-sys", "puffin", "puffin_egui"]
1 change: 1 addition & 0 deletions homestar-runtime/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ mod test {
}

#[test]
#[serial_test::parallel]
fn default_config() {
let settings = Settings::load().unwrap();
let default_config = Settings::build(Some("config/defaults.toml".into()))
Expand Down
7 changes: 6 additions & 1 deletion homestar-runtime/src/test_utils/proc_macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ proc_macro = true
doc = false

[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
syn = "2.0"
homestar-workspace-hack = { workspace = true }

[package.metadata.cargo-machete]
ignored = ["homestar-workspace-hack"]

[package.metadata.cargo-udeps.ignore]
normal = ["homestar-workspace-hack"]
6 changes: 6 additions & 0 deletions homestar-runtime/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::{
static BIN: Lazy<PathBuf> = Lazy::new(|| assert_cmd::cargo::cargo_bin(BIN_NAME));

#[test]
#[serial_test::parallel]
fn test_help_integration() -> Result<()> {
Command::new(BIN.as_os_str())
.arg("help")
Expand Down Expand Up @@ -45,6 +46,7 @@ fn test_help_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_version_integration() -> Result<()> {
Command::new(BIN.as_os_str())
.arg("--version")
Expand All @@ -60,6 +62,7 @@ fn test_version_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_server_not_running_integration() -> Result<()> {
Command::new(BIN.as_os_str())
.arg("ping")
Expand Down Expand Up @@ -95,6 +98,7 @@ fn test_server_not_running_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_server_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down Expand Up @@ -168,6 +172,7 @@ fn test_server_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_workflow_run_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down Expand Up @@ -299,6 +304,7 @@ fn test_daemon_serial() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_server_v4_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down
1 change: 1 addition & 0 deletions homestar-runtime/tests/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use std::{
static BIN: Lazy<PathBuf> = Lazy::new(|| assert_cmd::cargo::cargo_bin(BIN_NAME));

#[test]
#[serial_test::parallel]
fn test_metrics_integration() -> Result<()> {
fn sample_metrics(port: u16) -> Option<prometheus_parse::Value> {
let url = format!("http://localhost:{}/metrics", port);
Expand Down
6 changes: 6 additions & 0 deletions homestar-runtime/tests/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ mod rendezvous;
static BIN: Lazy<PathBuf> = Lazy::new(|| assert_cmd::cargo::cargo_bin(BIN_NAME));

#[test]
#[serial_test::parallel]
fn test_libp2p_generates_peer_id_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down Expand Up @@ -81,6 +82,7 @@ fn test_libp2p_generates_peer_id_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_listens_on_address_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down Expand Up @@ -141,6 +143,7 @@ fn test_libp2p_listens_on_address_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_rpc_listens_on_address_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down Expand Up @@ -197,6 +200,7 @@ fn test_rpc_listens_on_address_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_websocket_listens_on_address_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down Expand Up @@ -253,6 +257,7 @@ fn test_websocket_listens_on_address_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_connect_known_peers_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -440,6 +445,7 @@ fn test_libp2p_connect_known_peers_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_disconnect_known_peers_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down
12 changes: 7 additions & 5 deletions homestar-runtime/tests/network/dht.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const SUBSCRIBE_NETWORK_EVENTS_ENDPOINT: &str = "subscribe_network_events";
const UNSUBSCRIBE_NETWORK_EVENTS_ENDPOINT: &str = "unsubscribe_network_events";

#[test]
#[serial_test::file_serial]
#[serial_test::parallel]
fn test_libp2p_dht_records_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -366,7 +366,7 @@ fn test_libp2p_dht_records_integration() -> Result<()> {
}

#[test]
#[serial_test::file_serial]
#[serial_test::parallel]
fn test_libp2p_dht_quorum_failure_intregration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -586,6 +586,7 @@ fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> {
[node.network.keypair_config]
existing = {{ key_type = "ed25519", path = "./fixtures/__testkey_ed25519.pem" }}
[node.network.libp2p]
idle_connection_timeout = 180
listen_address = "{listen_addr1}"
node_addresses = ["{node_addrb}"]
[node.network.libp2p.dht]
Expand Down Expand Up @@ -648,6 +649,7 @@ fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> {
[node.network.keypair_config]
existing = {{ key_type = "secp256k1", path = "./fixtures/__testkey_secp256k1.der" }}
[node.network.libp2p]
idle_connection_timeout = 180
listen_address = "{listen_addr2}"
node_addresses = ["{node_addra}"]
[node.network.libp2p.dht]
Expand Down Expand Up @@ -747,7 +749,7 @@ fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> {
// Poll for sent workflow info message
let sent_workflow_info_cid: Cid;
loop {
if let Ok(msg) = sub1.next().with_timeout(Duration::from_secs(60)).await {
if let Ok(msg) = sub1.next().with_timeout(Duration::from_secs(30)).await {
let json: serde_json::Value =
serde_json::from_slice(&msg.unwrap().unwrap()).unwrap();

Expand All @@ -769,7 +771,7 @@ fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> {
// Poll for retrieved workflow info message
let received_workflow_info_cid: Cid;
loop {
if let Ok(msg) = sub2.next().with_timeout(Duration::from_secs(30)).await {
if let Ok(msg) = sub2.next().with_timeout(Duration::from_secs(60)).await {
let json: serde_json::Value =
serde_json::from_slice(&msg.unwrap().unwrap()).unwrap();

Expand Down Expand Up @@ -856,7 +858,7 @@ fn test_libp2p_dht_workflow_info_provider_integration() -> Result<()> {

#[ignore]
#[test]
#[serial_test::file_serial]
#[serial_test::parallel]
fn test_libp2p_dht_workflow_info_provider_recursive_integration() -> Result<()> {
// NOTE: We are ignoring this test for now because we do not have a means
// to properly isolate node a from node c. In the future when nodes are
Expand Down
1 change: 1 addition & 0 deletions homestar-runtime/tests/network/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const SUBSCRIBE_NETWORK_EVENTS_ENDPOINT: &str = "subscribe_network_events";
const UNSUBSCRIBE_NETWORK_EVENTS_ENDPOINT: &str = "unsubscribe_network_events";

#[test]
#[serial_test::parallel]
fn test_libp2p_receipt_gossip_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down
3 changes: 3 additions & 0 deletions homestar-runtime/tests/network/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const SUBSCRIBE_NETWORK_EVENTS_ENDPOINT: &str = "subscribe_network_events";
const UNSUBSCRIBE_NETWORK_EVENTS_ENDPOINT: &str = "unsubscribe_network_events";

#[test]
#[serial_test::parallel]
fn test_connection_notifications_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -186,6 +187,7 @@ fn test_connection_notifications_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_redial_on_connection_closed_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -360,6 +362,7 @@ fn test_libp2p_redial_on_connection_closed_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_redial_on_connection_error_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down
5 changes: 5 additions & 0 deletions homestar-runtime/tests/network/rendezvous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::{
static BIN: Lazy<PathBuf> = Lazy::new(|| assert_cmd::cargo::cargo_bin(BIN_NAME));

#[test]
#[serial_test::parallel]
fn test_libp2p_connect_rendezvous_discovery_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -224,6 +225,7 @@ fn test_libp2p_connect_rendezvous_discovery_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_disconnect_rendezvous_discovery_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -399,6 +401,7 @@ fn test_libp2p_disconnect_rendezvous_discovery_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_rendezvous_renew_registration_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -529,6 +532,7 @@ fn test_libp2p_rendezvous_renew_registration_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_rendezvous_rediscovery_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down Expand Up @@ -659,6 +663,7 @@ fn test_libp2p_rendezvous_rediscovery_integration() -> Result<()> {
}

#[test]
#[serial_test::parallel]
fn test_libp2p_rendezvous_rediscover_on_expiration_integration() -> Result<()> {
let proc_info1 = ProcInfo::new().unwrap();
let proc_info2 = ProcInfo::new().unwrap();
Expand Down
1 change: 1 addition & 0 deletions homestar-runtime/tests/webserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const UNSUBSCRIBE_RUN_WORKFLOW_ENDPOINT: &str = "unsubscribe_run_workflow";
const AWAIT_CID: &str = "bafyrmiga45pxzlihf726utrixg7a5zavauggtqqkqnc6bzybr7icpbdu6a";

#[test]
#[serial_test::parallel]
fn test_workflow_run_integration() -> Result<()> {
let proc_info = ProcInfo::new().unwrap();
let rpc_port = proc_info.rpc_port;
Expand Down
6 changes: 6 additions & 0 deletions homestar-wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ test-utils = []
all-features = true
# defines the configuration attribute `docsrs`
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.cargo-machete]
ignored = ["homestar-workspace-hack"]

[package.metadata.cargo-udeps.ignore]
normal = ["homestar-workspace-hack"]
Loading

0 comments on commit 9a81e45

Please sign in to comment.