Skip to content

Commit

Permalink
Fix context error in govultr test (#239)
Browse files Browse the repository at this point in the history
* Fix context error in govultr test

* Don't lint test error handling

* Remove github set-ouput test coverage action

* Remove github action dump to file

* Remove codecov action
  • Loading branch information
optik-aper authored Mar 13, 2023
1 parent fe35f2a commit 604570e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 41 deletions.
39 changes: 1 addition & 38 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,4 @@ jobs:
- name: Run unit tests and coverage test
id: test-coverage
run: |
go test -cover -v > output.txt
- name: Transform output
id: results
if: always()
run: |
CONTENT=$(cat output.txt)
CONTENT="${CONTENT//'%'/'%25'}"
CONTENT="${CONTENT//$'\n'/'%0A'}"
CONTENT="${CONTENT//$'\r'/'%0D'}"
echo "::set-output name=content::$CONTENT"
comment:
runs-on: ubuntu-latest
if: github.event_name != 'push'
needs: coverage
steps:
- name: Add Comment
uses: actions/github-script@v5
if: always()
with:
script: |
const output = `### Unit Tests and Coverage
<details><summary>Show Output</summary>
\`\`\`
${{ needs.coverage.outputs.msg }}
\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
go test -cover -v
4 changes: 1 addition & 3 deletions govultr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ func TestClient_DoWithContextError(t *testing.T) {
panicked = fmt.Sprint(err)
}
}()
if err := client.DoWithContext(context.Background(), req, nil); err != nil {
t.Errorf("dowithcontext error: %s", err)
}
client.DoWithContext(context.Background(), req, nil) //nolint:all
}()
if panicked != "" {
t.Errorf("unexpected panic: %s", panicked)
Expand Down

0 comments on commit 604570e

Please sign in to comment.