Skip to content

Commit 8e49966

Browse files
authored
NO-SNOW Fix flaky TestAuthenticationTimeout (#1320)
1 parent 1e49548 commit 8e49966

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

authexternalbrowser_test.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ func postAuthExternalBrowserError(_ context.Context, _ *snowflakeRestful, _ map[
6464
return &authResponse{}, errors.New("failed to get SAML response")
6565
}
6666

67+
func postAuthExternalBrowserErrorDelayed(_ context.Context, _ *snowflakeRestful, _ map[string]string, _ []byte, _ time.Duration) (*authResponse, error) {
68+
time.Sleep(2 * time.Second)
69+
return &authResponse{}, errors.New("failed to get SAML response")
70+
}
71+
6772
func postAuthExternalBrowserFail(_ context.Context, _ *snowflakeRestful, _ map[string]string, _ []byte, _ time.Duration) (*authResponse, error) {
6873
return &authResponse{
6974
Success: false,
@@ -122,12 +127,12 @@ func TestAuthenticationTimeout(t *testing.T) {
122127
account := "testaccount"
123128
user := "u"
124129
password := "p"
125-
timeout := 0 * time.Second
130+
timeout := 1 * time.Second
126131
sr := &snowflakeRestful{
127132
Protocol: "https",
128133
Host: "abc.com",
129134
Port: 443,
130-
FuncPostAuthSAML: postAuthExternalBrowserError,
135+
FuncPostAuthSAML: postAuthExternalBrowserErrorDelayed,
131136
TokenAccessor: getSimpleTokenAccessor(),
132137
}
133138
_, _, err := authenticateByExternalBrowser(context.Background(), sr, authenticator, application, account, user, password, timeout, ConfigBoolTrue)

0 commit comments

Comments
 (0)