mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: update testutil chan helpers (#17408)
This commit is contained in:
@@ -427,7 +427,7 @@ func TestPGCoordinatorUnhealthy(t *testing.T) {
|
||||
|
||||
pID := uuid.UUID{5}
|
||||
_, resps := coordinator.Coordinate(ctx, pID, "test", agpl.AgentCoordinateeAuth{ID: pID})
|
||||
resp := testutil.RequireRecvCtx(ctx, t, resps)
|
||||
resp := testutil.TryReceive(ctx, t, resps)
|
||||
require.Nil(t, resp, "channel should be closed")
|
||||
|
||||
// give the coordinator some time to process any pending work. We are
|
||||
|
||||
@@ -943,9 +943,9 @@ func TestPGCoordinatorPropogatedPeerContext(t *testing.T) {
|
||||
|
||||
reqs, _ := c1.Coordinate(peerCtx, peerID, "peer1", auth)
|
||||
|
||||
testutil.RequireSendCtx(ctx, t, reqs, &proto.CoordinateRequest{AddTunnel: &proto.CoordinateRequest_Tunnel{Id: agpl.UUIDToByteSlice(agentID)}})
|
||||
testutil.RequireSend(ctx, t, reqs, &proto.CoordinateRequest{AddTunnel: &proto.CoordinateRequest_Tunnel{Id: agpl.UUIDToByteSlice(agentID)}})
|
||||
|
||||
_ = testutil.RequireRecvCtx(ctx, t, ch)
|
||||
_ = testutil.TryReceive(ctx, t, ch)
|
||||
}
|
||||
|
||||
func assertEventuallyStatus(ctx context.Context, t *testing.T, store database.Store, agentID uuid.UUID, status database.TailnetStatus) {
|
||||
|
||||
@@ -780,7 +780,7 @@ func TestWorkspaceProxyDERPMeshProbe(t *testing.T) {
|
||||
require.NoError(t, err, "failed to force proxy to re-register")
|
||||
|
||||
// Wait for the ping to fail.
|
||||
replicaErr := testutil.RequireRecvCtx(ctx, t, replicaPingErr)
|
||||
replicaErr := testutil.TryReceive(ctx, t, replicaPingErr)
|
||||
require.NotEmpty(t, replicaErr, "replica ping error")
|
||||
|
||||
// GET /healthz-report
|
||||
@@ -858,7 +858,7 @@ func TestWorkspaceProxyDERPMeshProbe(t *testing.T) {
|
||||
|
||||
// Wait for the ping to fail.
|
||||
for {
|
||||
replicaErr := testutil.RequireRecvCtx(ctx, t, replicaPingErr)
|
||||
replicaErr := testutil.TryReceive(ctx, t, replicaPingErr)
|
||||
t.Log("replica ping error:", replicaErr)
|
||||
if replicaErr != "" {
|
||||
break
|
||||
@@ -892,7 +892,7 @@ func TestWorkspaceProxyDERPMeshProbe(t *testing.T) {
|
||||
|
||||
// Wait for the ping to be skipped.
|
||||
for {
|
||||
replicaErr := testutil.RequireRecvCtx(ctx, t, replicaPingErr)
|
||||
replicaErr := testutil.TryReceive(ctx, t, replicaPingErr)
|
||||
t.Log("replica ping error:", replicaErr)
|
||||
// Should be empty because there are no more peers. This was where
|
||||
// the regression was.
|
||||
|
||||
Reference in New Issue
Block a user