Skip to content

fix: resolve flakey inbox tests #17010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: add error checking
  • Loading branch information
DanielleMaywood committed Mar 19, 2025
commit 042b159c4a71aafa74b74c1e1ee13cd3926bef48
21 changes: 14 additions & 7 deletions coderd/inboxnotifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ func TestInboxNotification_Watch(t *testing.T) {
}, "notification title", "notification content", nil)
require.NoError(t, err)

dispatchFunc(ctx, uuid.New())
_, err = dispatchFunc(ctx, uuid.New())
require.NoError(t, err)

_, message, err := wsConn.Read(ctx)
require.NoError(t, err)
Expand Down Expand Up @@ -174,7 +175,8 @@ func TestInboxNotification_Watch(t *testing.T) {
}, "memory related title", "memory related content", nil)
require.NoError(t, err)

dispatchFunc(ctx, uuid.New())
_, err = dispatchFunc(ctx, uuid.New())
require.NoError(t, err)

_, message, err := wsConn.Read(ctx)
require.NoError(t, err)
Expand All @@ -193,15 +195,17 @@ func TestInboxNotification_Watch(t *testing.T) {
}, "disk related title", "disk related title", nil)
require.NoError(t, err)

dispatchFunc(ctx, uuid.New())
_, err = dispatchFunc(ctx, uuid.New())
require.NoError(t, err)

dispatchFunc, err = inboxHandler.Dispatcher(types.MessagePayload{
UserID: memberClient.ID.String(),
NotificationTemplateID: notifications.TemplateWorkspaceOutOfMemory.String(),
}, "second memory related title", "second memory related title", nil)
require.NoError(t, err)

dispatchFunc(ctx, uuid.New())
_, err = dispatchFunc(ctx, uuid.New())
require.NoError(t, err)

_, message, err = wsConn.Read(ctx)
require.NoError(t, err)
Expand Down Expand Up @@ -256,7 +260,8 @@ func TestInboxNotification_Watch(t *testing.T) {
}, "memory related title", "memory related content", nil)
require.NoError(t, err)

dispatchFunc(ctx, uuid.New())
_, err = dispatchFunc(ctx, uuid.New())
require.NoError(t, err)

_, message, err := wsConn.Read(ctx)
require.NoError(t, err)
Expand All @@ -276,7 +281,8 @@ func TestInboxNotification_Watch(t *testing.T) {
}, "second memory related title", "second memory related title", nil)
require.NoError(t, err)

dispatchFunc(ctx, uuid.New())
_, err = dispatchFunc(ctx, uuid.New())
require.NoError(t, err)

dispatchFunc, err = inboxHandler.Dispatcher(types.MessagePayload{
UserID: memberClient.ID.String(),
Expand All @@ -285,7 +291,8 @@ func TestInboxNotification_Watch(t *testing.T) {
}, "another memory related title", "another memory related title", nil)
require.NoError(t, err)

dispatchFunc(ctx, uuid.New())
_, err = dispatchFunc(ctx, uuid.New())
require.NoError(t, err)

_, message, err = wsConn.Read(ctx)
require.NoError(t, err)
Expand Down
Loading