Skip to content

Commit

Permalink
fix: actually cleaning up the test with RemovalAll seems to cause a p…
Browse files Browse the repository at this point in the history
…anic

Signed-off-by: Kit Patella <[email protected]>
  • Loading branch information
mkcp committed Sep 25, 2024
1 parent 29c5d08 commit dfdf78a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/test/external/ext_in_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit dfdf78a

Please sign in to comment.