Skip to content

test: unit test flakes for activity logs stream #407

Description

@zimeg

Summary

A recent test run on main failed for reasons unrelated to the recent commit. Perhaps a timing of a poll?

The retry succeeded! 🧪 ✨

Preview

🔗 https://github.com/slackapi/slack-cli/actions/runs/23178071163/job/67344594805

=== RUN   TestPlatformActivity_StreamingLogs/should_return_nil_if_TailArg_is_set_and_activity_request_fails_while_polling
    activity_test.go:267: 
        	Error Trace:	/Users/runner/work/slack-cli/slack-cli/internal/pkg/platform/activity_test.go:267
        	            				/Users/runner/work/slack-cli/slack-cli/internal/pkg/platform/activity_test.go:296
        	Error:      	Not equal: 
        	            	expected: 3
        	            	actual  : 4
        	Test:       	TestPlatformActivity_StreamingLogs/should_return_nil_if_TailArg_is_set_and_activity_request_fails_while_polling
        	Messages:   	Expected number of calls (3) of method Activity does not match the actual number of calls (4).

"should return nil if TailArg is set and activity request fails while polling": {
Args: types.ActivityArgs{
TailArg: true,
IdleTimeoutM: 1,
PollingIntervalMS: 20, // poll activity every 20 ms
},
Setup: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) context.Context {
cm.API.On("Activity", mock.Anything, mock.Anything, mock.Anything).Return(api.ActivityResult{}, slackerror.New("mock_broken_logs"))
ctx, cancel := context.WithCancel(ctx)
go func() {
time.Sleep(time.Millisecond * 50) // cancel activity in 50 ms
cancel()
}()
return ctx
},
ExpectedError: nil,
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
// with the above polling/canceling setup, expectation is activity called three times.
cm.API.AssertNumberOfCalls(t, "Activity", 3)
},
},

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    code healthM-T: Test improvements and anything that improves code health

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions