From 923536134ec0a0b8fe2767f93794de1503ed49d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Mon, 11 Sep 2023 12:22:31 +0200 Subject: [PATCH] chore(pulsar): create/remove the network properly --- modules/pulsar/pulsar_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/pulsar/pulsar_test.go b/modules/pulsar/pulsar_test.go index 96a6969c22..026b59b2c0 100644 --- a/modules/pulsar/pulsar_test.go +++ b/modules/pulsar/pulsar_test.go @@ -36,7 +36,7 @@ func TestPulsar(t *testing.T) { defer cancel() nwName := "pulsar-test" - _, err := testcontainers.GenericNetwork(ctx, testcontainers.GenericNetworkRequest{ + nw, err := testcontainers.GenericNetwork(context.Background(), testcontainers.GenericNetworkRequest{ NetworkRequest: testcontainers.NetworkRequest{ Name: nwName, }, @@ -211,4 +211,11 @@ func TestPulsar(t *testing.T) { assert.True(t, ok) }) } + + // remove the network after the last, so that all containers are already removed + // and there are no active endpoints on the network + t.Cleanup(func() { + err := nw.Remove(context.Background()) + require.NoError(t, err) + }) }