Skip to content

Commit

Permalink
Truncate test result files
Browse files Browse the repository at this point in the history
Problem: The NFR tests need to update the edge results, but they are
appending the new results to the existing ones

Solution: Truncate existing results files so that the content is replaced
and we see the diff in the PR
  • Loading branch information
lucacome committed Jul 17, 2024
1 parent 4813408 commit a279699
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/nfr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ jobs:
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
path: tests/results/
merge-multiple: true

- name: Open a PR with the results
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func CreateResultsDir(testName, version string) (string, error) {

// CreateResultsFile creates and returns the results file for a test.
func CreateResultsFile(filename string) (*os.File, error) {
outFile, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0o777)
outFile, err := os.OpenFile(filename, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0o644)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit a279699

Please sign in to comment.