Skip to content

Commit

Permalink
patch: update ci and fix TestDrainers tests
Browse files Browse the repository at this point in the history
- `TestDrainer` tests weren't well made, they led to a race-like condition where a slow running machine will fail some draining tests
  • Loading branch information
denopink committed Oct 21, 2024
1 parent cdd32a2 commit 7903139
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ on:

jobs:
ci:
uses: xmidt-org/shared-go/.github/workflows/ci.yml@5bc4b83f25ff4c944cd6253ba189e50d1997ab3c # v4.1.0
uses: xmidt-org/shared-go/.github/workflows/ci.yml@3d552804b9a20638508bf359cdd2e9b46bc06879 # v4.4.24
with:
copyright-skip: true
lint-skip: true
style-skip: true
# tests-skip: true
release-type: library
style-skip: true
yaml-lint-skip: true
copyright-skip: true
lint-skip: true
release-type: library
release-docker: false
secrets: inherit
9 changes: 5 additions & 4 deletions device/drain/drainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func testDrainerDrainAll(t *testing.T, deviceCount int) {
select {
case <-done:
// passed
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
assert.Fail("Drain failed to complete")
return
}
Expand Down Expand Up @@ -594,7 +594,7 @@ func testDrainerDrainCancel(t *testing.T) {
select {
case <-done:
// passing
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
assert.Fail("Drain failed to complete")
return
}
Expand Down Expand Up @@ -645,6 +645,7 @@ func testDrainFilter(t *testing.T, deviceTypeOne deviceInfo, deviceTypeTwo devic

stopCalled = false
stop = func() {
time.Sleep(time.Second * 5)
stopCalled = true
}

Expand Down Expand Up @@ -744,7 +745,7 @@ func testDrainFilter(t *testing.T, deviceTypeOne deviceInfo, deviceTypeTwo devic
select {
case <-done:
// passed
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
assert.Fail("Drain failed to complete")
return
}
Expand Down Expand Up @@ -882,7 +883,7 @@ func testDisconnectFilter(t *testing.T, deviceTypeOne deviceInfo, deviceTypeTwo
select {
case <-done:
// passed
case <-time.After(5 * time.Second):
case <-time.After(10 * time.Second):
assert.Fail("Drain failed to complete")
return
}
Expand Down

0 comments on commit 7903139

Please sign in to comment.