Skip to content

Commit

Permalink
Update test.yml for v2 (#78)
Browse files Browse the repository at this point in the history
* Update test.yml for v2

* Update test.yml

* Update test.yml

* Update test.yml

* Update test.yml

* Update test.yml

* Update test.yml

* Create .golangci.yaml

* Update gobreaker_test.go

* Delete v2/.golangci.yaml
  • Loading branch information
YoshiyukiMineo authored Dec 28, 2024
1 parent 9e2b7bf commit d78b227
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ jobs:
matrix:
go-version: [1.22.x, 1.23.x]
os: [ubuntu-latest]
work-dir: ["./", "./v2"]
runs-on: ${{matrix.os}}
defaults:
run:
working-directory: ${{matrix.work-dir}}
steps:
- name: Setup Go
uses: actions/setup-go@v5
Expand All @@ -16,6 +20,8 @@ jobs:
uses: actions/checkout@v4
- name: Lint
uses: golangci/golangci-lint-action@v6
with:
working-directory: ${{matrix.work-dir}}
- name: go test
run: go test -v ./...
- name: Run example
Expand Down
6 changes: 3 additions & 3 deletions v2/gobreaker_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gobreaker

import (
"fmt"
"errors"
"runtime"
"testing"
"time"
Expand Down Expand Up @@ -55,7 +55,7 @@ func succeed2Step(cb *TwoStepCircuitBreaker[bool]) error {

func fail(cb *CircuitBreaker[bool]) error {
msg := "fail"
_, err := cb.Execute(func() (bool, error) { return false, fmt.Errorf(msg) })
_, err := cb.Execute(func() (bool, error) { return false, errors.New(msg) })
if err.Error() == msg {
return nil
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func TestTwoStepCircuitBreaker(t *testing.T) {
}

func TestPanicInRequest(t *testing.T) {
assert.Panics(t, func() { causePanic(defaultCB) })
assert.Panics(t, func() { _ = causePanic(defaultCB) })
assert.Equal(t, Counts{1, 0, 1, 0, 1}, defaultCB.counts)
}

Expand Down

0 comments on commit d78b227

Please sign in to comment.