As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit f5ae8fa3 authored by Stan Hu's avatar Stan Hu
Browse files

Fix flaky race test

`ignoredError.err` was being used in a Goroutine handler, but the
value of `ignoredError` changes with each test case. To avoid a race,
make a local copy of the error before each Goroutine runs.

Closes https://gitlab.com/gitlab-org/gitlab-shell/-/issues/590
parent 2d25f827
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -225,9 +225,10 @@ func TestSessionsMetrics(t *testing.T) {
} {
t.Run(ignoredError.desc, func(t *testing.T) {
conn, chans = setup(1, newChannel)
ignored := ignoredError.err
conn.handleRequests(context.Background(), nil, chans, func(*ssh.ServerConn, ssh.Channel, <-chan *ssh.Request) error {
close(chans)
return ignoredError.err
return ignored
})
require.InDelta(t, initialSessionsTotal+2+float64(i), testutil.ToFloat64(metrics.SliSshdSessionsTotal), 0.1)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment