From dfdf78a495ac70f7b07150c9039e8d937e223c2d Mon Sep 17 00:00:00 2001 From: Kit Patella Date: Wed, 25 Sep 2024 13:40:16 -0700 Subject: [PATCH] fix: actually cleaning up the test with RemovalAll seems to cause a panic Signed-off-by: Kit Patella --- src/test/external/ext_in_cluster_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/test/external/ext_in_cluster_test.go b/src/test/external/ext_in_cluster_test.go index 89f6b24fe8..57f7588dac 100644 --- a/src/test/external/ext_in_cluster_test.go +++ b/src/test/external/ext_in_cluster_test.go @@ -157,7 +157,7 @@ func (suite *ExtInClusterTestSuite) Test_1_Deploy() { err := exec.CmdWithPrint(zarfBinPath, initArgs...) suite.NoError(err, "unable to initialize the k8s server with zarf") temp := suite.T().TempDir() - defer createPodInfoPackageWithInsecureSources(suite.T(), temp) + createPodInfoPackageWithInsecureSources(suite.T(), temp) // Deploy the flux example package deployArgs := []string{"package", "deploy", filepath.Join(temp, "zarf-package-podinfo-flux-amd64.tar.zst"), "--confirm"} @@ -200,8 +200,10 @@ func (suite *ExtInClusterTestSuite) Test_1_Deploy() { _, _, err = exec.CmdWithTesting(suite.T(), exec.PrintCfg(), zarfBinPath, "destroy", "--confirm") suite.NoError(err, "unable to teardown zarf") - err = os.RemoveAll(temp) - suite.NoError(err, "unable to remove temp directory") + // FIXME(mkcp): This code always fails to clean up the tmpdir. We're passing it a directory with contents and we + // need os.RemoveAll(temp) instead. However, we're also getting what looks to be a bug with concurrent writers + // causing a subtest to panic when we call RemoveAll(). Fixing this would require removing the shared state. + _ = os.Remove(temp) // nolint:errcheck } func TestExtInClusterTestSuite(t *testing.T) {