Skip to content

Commit

Permalink
pin gocovmerge, factor out stripCoverageOutput
Browse files Browse the repository at this point in the history
Signed-off-by: Ceridwen Driskill <cdriskill@google.com>
  • Loading branch information
Ceridwen Driskill committed Sep 23, 2022
1 parent 7e4a588 commit a62fbc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Expand Up @@ -80,7 +80,7 @@ jobs:
with:
go-version: ${{ env.GOVERSION }}
- name: install gocovmerge
run: go install github.com/wadey/gocovmerge@latest
run: go install github.com/wadey/gocovmerge@b5bfa59ec0adc420475f97f89b58045c721d761c

- name: CLI
run: ./tests/e2e-test.sh
Expand Down
14 changes: 7 additions & 7 deletions tests/util.go
Expand Up @@ -63,9 +63,7 @@ func run(t *testing.T, stdin, cmd string, arg ...string) string {
t.Log(string(b))
t.Fatal(err)
}

// Remove test coverage output
return strings.Split(strings.Split(string(b), "PASS")[0], "FAIL")[0]
return stripCoverageOutput(string(b))
}

func runCli(t *testing.T, arg ...string) string {
Expand Down Expand Up @@ -95,8 +93,7 @@ func runCliStdout(t *testing.T, arg ...string) string {
t.Log(string(b))
t.Fatal(err)
}
// Remove test coverage output
return strings.Split(strings.Split(string(b), "PASS")[0], "FAIL")[0]
return stripCoverageOutput(string(b))
}

func runCliErr(t *testing.T, arg ...string) string {
Expand All @@ -115,8 +112,7 @@ func runCliErr(t *testing.T, arg ...string) string {
t.Log(string(b))
t.Fatalf("expected error, got %s", string(b))
}
// Remove test coverage output
return strings.Split(strings.Split(string(b), "PASS")[0], "FAIL")[0]
return stripCoverageOutput(string(b))
}

func rekorServerFlag() string {
Expand All @@ -134,6 +130,10 @@ func coverageFlag() string {
return "-test.coverprofile=/tmp/rekor-cli."+randomSuffix(8)+".cov"
}

func stripCoverageOutput(out string) string {
return strings.Split(strings.Split(out, "PASS")[0], "FAIL")[0]
}

func readFile(t *testing.T, p string) string {
b, err := ioutil.ReadFile(p)
if err != nil {
Expand Down

0 comments on commit a62fbc6

Please sign in to comment.