Skip to content

Commit 883cf0d

Browse files
authored
close state file in TestComponentBuildHashInDiagnostics (#4596)
1 parent 746f9cf commit 883cf0d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

testing/integration/package_version_test.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,13 @@ func TestComponentBuildHashInDiagnostics(t *testing.T) {
160160
diag := t.TempDir()
161161
extractZipArchive(t, diagZip, diag)
162162

163-
stateYAML, err := os.Open(filepath.Join(diag, "state.yaml"))
163+
stateFilePath := filepath.Join(diag, "state.yaml")
164+
stateYAML, err := os.Open(stateFilePath)
164165
require.NoError(t, err, "could not open diagnostics state.yaml")
166+
defer func(stateYAML *os.File) {
167+
err := stateYAML.Close()
168+
assert.NoErrorf(t, err, "error closing %q", stateFilePath)
169+
}(stateYAML)
165170

166171
state := struct {
167172
Components []struct {

0 commit comments

Comments
 (0)