Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
bysomeone committed May 12, 2024
1 parent 6319ef3 commit 390b21f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,3 @@ jobs:
make build_ci
make autotest dapp=all
make docker-compose && make docker-compose-down
test-goarch-386:
name: Run test cases with GOARCH=386
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'

- name: Build
run: make build
env:
GOARCH: 386

- name: Run test in 386
run: go test ./... -covermode=atomic
env:
GOARCH: 386

4 changes: 3 additions & 1 deletion system/consensus/snowman/snowman.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"encoding/hex"
"runtime"
"sync"
"sync/atomic"
"time"

sncom "github.com/ava-labs/avalanchego/snow/engine/common"
Expand Down Expand Up @@ -51,7 +52,7 @@ type snowman struct {
inMsg chan *queue.Message
engineNotify chan struct{}
params snowball.Parameters
initDone bool
initDone atomic.Bool
lock sync.RWMutex
}

Expand Down Expand Up @@ -113,6 +114,7 @@ func (s *snowman) startRoutine() {
}

go s.dispatchSyncMsg()
s.initDone.Store(true)
snowLog.Debug("snowman startRoutine done")

}
Expand Down
4 changes: 2 additions & 2 deletions system/consensus/snowman/snowman_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ func TestSnowman(t *testing.T) {
sm := &snowman{}
sm.Initialize(ctx)

for timeout := 0; atomic.LoadInt64(&sm.vm.acceptedHeight) < 1; timeout++ {
for timeout := 0; sm.initDone.Load() == false; timeout++ {
time.Sleep(time.Second)
timeout++
if timeout >= 3 {
t.Errorf("test timeout acceptHeight=%d", atomic.LoadInt64(&sm.vm.acceptedHeight))
t.Errorf("wait snowman init timeout")
return
}
}
Expand Down

0 comments on commit 390b21f

Please sign in to comment.