Skip to content

Commit

Permalink
Make flaky test less likely to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Feb 4, 2025
1 parent 706f5e4 commit 0c4a9b1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,12 @@ func TestSpacemeshApp_NodeService(t *testing.T) {
return app.Start(appCtx)
}

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

// Run the app in a goroutine. As noted above, it blocks if it succeeds.
// If there's an error in the args, it will return immediately.
var eg errgroup.Group
eg.Go(func() error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
str, err := testArgs(ctx, cmdWithRun(run))
assert.Empty(t, str)
assert.NoError(t, err)
Expand All @@ -397,7 +396,10 @@ func TestSpacemeshApp_NodeService(t *testing.T) {
)
require.NoError(t, err)
t.Cleanup(func() { assert.NoError(t, conn.Close()) })

c := pb.NewNodeServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()

eg.Go(func() error {
streamStatus, err := c.StatusStream(ctx, &pb.StatusStreamRequest{})
Expand Down

0 comments on commit 0c4a9b1

Please sign in to comment.