Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 63981b5

Browse files
authored
Allow a bit more time for mocked tests to correctly cleanup. (#3060)
This should avoid some sporadic CI test failures.
1 parent 50561aa commit 63981b5

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

‎internal/integrationtest/daemon/discoveries_test.go‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package daemon
1717

1818
import (
1919
"fmt"
20+
"os"
2021
"testing"
2122
"time"
2223

@@ -66,8 +67,15 @@ func TestBoardListMock(t *testing.T) {
6667
}))
6768

6869
// Run a BoardList
69-
resp, err := grpcInst.BoardList(time.Second)
70-
require.NoError(t, err)
70+
var resp *commands.BoardListResponse
71+
for range 5 { // wait up to 5 seconds
72+
resp, err = grpcInst.BoardList(time.Second)
73+
require.NoError(t, err)
74+
if len(resp.Ports) > 0 {
75+
break
76+
}
77+
time.Sleep(time.Second)
78+
}
7179
require.NotEmpty(t, resp.Ports)
7280
for _, port := range resp.Ports {
7381
if port.GetPort().GetProtocol() == "serial" {
@@ -81,6 +89,14 @@ func TestBoardListMock(t *testing.T) {
8189
}
8290

8391
// Check if the discoveries have been successfully close
92+
for range 5 { // wait up to 5 seconds
93+
_, err1 := os.Lstat(tmp1)
94+
_, err2 := os.Lstat(tmp2)
95+
if err1 != nil && err2 != nil {
96+
break
97+
}
98+
time.Sleep(time.Second)
99+
}
84100
require.NoFileExists(t, tmp1, "discovery has not been closed")
85101
require.NoFileExists(t, tmp2, "discovery has not been closed")
86102
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /