From 36a63ca4159dc40002cc32d652682848823f0c32 Mon Sep 17 00:00:00 2001 From: David Pacheco Date: Thu, 28 Apr 2022 12:34:02 -0700 Subject: [PATCH] many tests do not clean up after themselves --- gateway/tests/integration_tests/serial_console.rs | 7 +++++-- nexus/src/db/datastore.rs | 5 +++++ nexus/src/db/explain.rs | 3 +++ nexus/src/db/lookup.rs | 1 + nexus/tests/integration_tests/updates.rs | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/gateway/tests/integration_tests/serial_console.rs b/gateway/tests/integration_tests/serial_console.rs index 4a32ad110c3..ceda41441a6 100644 --- a/gateway/tests/integration_tests/serial_console.rs +++ b/gateway/tests/integration_tests/serial_console.rs @@ -101,12 +101,13 @@ async fn serial_console_communication() { Message::Binary(msg_from_sp) ); } + + testctx.teardown().await; } #[tokio::test] async fn serial_console_detach() { - let testctx = - setup::test_setup("serial_console_communication", SpPort::One).await; + let testctx = setup::test_setup("serial_console_detach", SpPort::One).await; let client = &testctx.client; let simrack = &testctx.simrack; @@ -185,4 +186,6 @@ async fn serial_console_detach() { ws.next().await.unwrap().unwrap(), Message::Binary(b"world".to_vec()) ); + + testctx.teardown().await; } diff --git a/nexus/src/db/datastore.rs b/nexus/src/db/datastore.rs index 83126f60e72..ce710a3b12b 100644 --- a/nexus/src/db/datastore.rs +++ b/nexus/src/db/datastore.rs @@ -3158,6 +3158,7 @@ mod test { assert_eq!(0, disk1_datasets.intersection(&disk2_datasets).count()); let _ = db.cleanup().await; + logctx.cleanup_successful(); } #[tokio::test] @@ -3224,6 +3225,7 @@ mod test { } let _ = db.cleanup().await; + logctx.cleanup_successful(); } #[tokio::test] @@ -3272,6 +3274,7 @@ mod test { assert!(matches!(err, Error::ServiceUnavailable { .. })); let _ = db.cleanup().await; + logctx.cleanup_successful(); } // TODO: This test should be updated when the correct handling @@ -3318,6 +3321,7 @@ mod test { datastore.region_allocate(&opctx, volume1_id, ¶ms).await.unwrap(); let _ = db.cleanup().await; + logctx.cleanup_successful(); } // Validate that queries which should be executable without a full table @@ -3376,6 +3380,7 @@ mod test { ); let _ = db.cleanup().await; + logctx.cleanup_successful(); } // Test sled-specific IPv6 address allocation diff --git a/nexus/src/db/explain.rs b/nexus/src/db/explain.rs index 3dd5262a83a..c3c1f3a6f13 100644 --- a/nexus/src/db/explain.rs +++ b/nexus/src/db/explain.rs @@ -190,6 +190,7 @@ mod test { ) .await .unwrap(); + logctx.cleanup_successful(); } // Tests the ".explain_async()" method in an asynchronous context. @@ -211,6 +212,7 @@ mod test { .unwrap(); assert_contents("tests/output/test-explain-output", &explanation); + logctx.cleanup_successful(); } // Tests that ".explain()" can tell us when we're doing full table scans. @@ -236,5 +238,6 @@ mod test { "Expected [{}] to contain 'FULL SCAN'", explanation ); + logctx.cleanup_successful(); } } diff --git a/nexus/src/db/lookup.rs b/nexus/src/db/lookup.rs index 5bbe68b2cf9..6a3016cf133 100644 --- a/nexus/src/db/lookup.rs +++ b/nexus/src/db/lookup.rs @@ -617,5 +617,6 @@ mod test { } if *o == org_id && **p == project_name)); db.cleanup().await.unwrap(); + logctx.cleanup_successful(); } } diff --git a/nexus/tests/integration_tests/updates.rs b/nexus/tests/integration_tests/updates.rs index b996d91bdba..1bfa25d0a2c 100644 --- a/nexus/tests/integration_tests/updates.rs +++ b/nexus/tests/integration_tests/updates.rs @@ -99,6 +99,7 @@ async fn test_update_end_to_end() { server.close().await.expect("failed to shut down dropshot server"); cptestctx.teardown().await; + logctx.cleanup_successful(); } // =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^=