Skip to content

Commit 394d9cf

Browse files
committed
Fix tests to clean up networks
Signed-off-by: Erik Hollensbe <git@hollensbe.org>
1 parent ea7ab92 commit 394d9cf

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

tests/service.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,6 @@ impl TestContext {
198198
}
199199
}
200200

201-
lazy_static! {
202-
static ref NETWORKS: Arc<Mutex<HashMap<String, TestNetwork>>> =
203-
Arc::new(Mutex::new(HashMap::new()));
204-
}
205-
206201
// TestNetwork creates a testnetwork in central and joins it. When this data is destroyed/dropped
207202
// it will remove the network and leave it like nothing ever happened.
208203
#[derive(Clone)]
@@ -303,16 +298,13 @@ impl TestNetwork {
303298
}
304299

305300
pub fn teardown(&mut self) {
306-
let identity = self.identity();
307301
tokio::task::block_in_place(move || {
308302
tokio::runtime::Handle::current().block_on(async {
309-
if let Some(network) = NETWORKS.lock().await.remove(&identity) {
310-
network.leave().await.unwrap();
311-
let central = network.central();
312-
zerotier_central_api::apis::network_api::delete_network(&central, &identity)
313-
.await
314-
.unwrap();
315-
}
303+
self.leave().await.unwrap();
304+
let central = self.central();
305+
zerotier_central_api::apis::network_api::delete_network(&central, &self.identity())
306+
.await
307+
.unwrap_err();
316308
})
317309
})
318310
}

0 commit comments

Comments
 (0)