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
Commit 5f3b0d3f authored by Igor Drozdov's avatar Igor Drozdov
Browse files

Merge branch '657-the-testsessionsmetrics-test-from-connection_test-go-214-is-flaky' into 'main'

Ensure prometheus counter has time to increment

Closes #657

See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/795



Merged-by: default avatarIgor Drozdov <idrozdov@gitlab.com>
Approved-by: default avatarIgor Drozdov <idrozdov@gitlab.com>
Co-authored-by: default avatarAsh McKenzie <amckenzie@gitlab.com>
parents 7cd080ae 40234704
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -210,8 +210,8 @@ func TestSessionsMetrics(t *testing.T) {
return errors.New("custom error")
})
require.InDelta(t, initialSessionsTotal+1, testutil.ToFloat64(metrics.SliSshdSessionsTotal), 0.1)
require.InDelta(t, initialSessionsErrorTotal+1, testutil.ToFloat64(metrics.SliSshdSessionsErrorsTotal), 0.1)
eventuallyInDelta(t, initialSessionsTotal+1, testutil.ToFloat64(metrics.SliSshdSessionsTotal), 0.1)
eventuallyInDelta(t, initialSessionsErrorTotal+1, testutil.ToFloat64(metrics.SliSshdSessionsErrorsTotal), 0.1)
for i, ignoredError := range []struct {
desc string
Loading
Loading
@@ -231,8 +231,14 @@ func TestSessionsMetrics(t *testing.T) {
return ignored
})
require.InDelta(t, initialSessionsTotal+2+float64(i), testutil.ToFloat64(metrics.SliSshdSessionsTotal), 0.1)
require.InDelta(t, initialSessionsErrorTotal+1, testutil.ToFloat64(metrics.SliSshdSessionsErrorsTotal), 0.1)
eventuallyInDelta(t, initialSessionsTotal+2+float64(i), testutil.ToFloat64(metrics.SliSshdSessionsTotal), 0.1)
eventuallyInDelta(t, initialSessionsErrorTotal+1, testutil.ToFloat64(metrics.SliSshdSessionsErrorsTotal), 0.1)
})
}
}
func eventuallyInDelta(t *testing.T, expected, actual, delta float64) {
require.Eventually(t, func() bool {
return ((expected - actual) < delta)
}, 1*time.Second, time.Millisecond)
}
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