From ac2ca515fb8317da66712eb85b74a24824a196d2 Mon Sep 17 00:00:00 2001 From: Lucas Rodriguez Date: Thu, 30 May 2024 06:18:58 -0500 Subject: [PATCH] test: shutdown http test servers (#2559) ## Description Shutdown HTTP test servers with `Close()` ## Related Issue Noticed we aren't shutting down HTTP test servers in a couple of our unit tests while working on #2558 ## Checklist before merging - [x] Test, docs, adr added or updated as needed - [x] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow) followed Signed-off-by: Austin Abro --- src/pkg/packager/sources/new_test.go | 1 + src/pkg/utils/network_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/src/pkg/packager/sources/new_test.go b/src/pkg/packager/sources/new_test.go index 2e20bc1c21..91ea3e2c2f 100644 --- a/src/pkg/packager/sources/new_test.go +++ b/src/pkg/packager/sources/new_test.go @@ -130,6 +130,7 @@ func TestPackageSource(t *testing.T) { defer f.Close() io.Copy(rw, f) })) + t.Cleanup(func() { ts.Close() }) tests := []struct { name string diff --git a/src/pkg/utils/network_test.go b/src/pkg/utils/network_test.go index 4722993312..1728fe874b 100644 --- a/src/pkg/utils/network_test.go +++ b/src/pkg/utils/network_test.go @@ -85,6 +85,7 @@ func TestDownloadToFile(t *testing.T) { } rw.Write([]byte(content)) })) + t.Cleanup(func() { srv.Close() }) tests := []struct { name string