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

Use require.WithinDuration to fix flacky test

parent 199ea1d1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -196,8 +196,8 @@ func testJWTAuthenticationHeader(t *testing.T, client *GitlabNetClient) {
require.NoError(t, err)
require.True(t, token.Valid)
require.Equal(t, "gitlab-shell", claims.Issuer)
require.Equal(t, time.Now().Truncate(time.Second), claims.IssuedAt.Time, time.Second)
require.Equal(t, time.Now().Truncate(time.Second).Add(time.Minute), claims.ExpiresAt.Time, time.Second)
require.WithinDuration(t, time.Now().Truncate(time.Second), claims.IssuedAt.Time, time.Second)
require.WithinDuration(t, time.Now().Truncate(time.Second).Add(time.Minute), claims.ExpiresAt.Time, time.Second)
}
t.Run("JWT authentication headers for GET", func(t *testing.T) {
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