Skip to content

Commit

Permalink
Merge pull request #1162 from okta/close_tf_files_in_tests
Browse files Browse the repository at this point in the history
Ensure files are getting closed in tests
  • Loading branch information
monde authored Jun 10, 2022
2 parents ebf873f + b3063ec commit 89089a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions okta/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (manager *fixtureManager) GetFixtures(fixtureName string, rInt int, t *test
if err != nil {
t.Fatalf("failed to load terraform fixtures for ACC test, err: %v", err)
}
defer file.Close()
rawFile, err := ioutil.ReadAll(file)
if err != nil {
t.Fatalf("failed to load terraform fixtures for ACC test, err: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion okta/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,11 @@ func computeFileHash(filename string) string {
if err != nil {
return ""
}
defer file.Close()
h := sha256.New()
if _, err := io.Copy(h, file); err != nil {
log.Fatal(err)
}
_ = file.Close()
return hex.EncodeToString(h.Sum(nil))
}

Expand Down

0 comments on commit 89089a1

Please sign in to comment.