Skip to content

Commit 09f4086

Browse files
authored
NO-SNOW Fix tests failing on Jenkins (#1258)
1 parent e8d7ff2 commit 09f4086

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

connection_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ func TestIsPrivateLink(t *testing.T) {
501501
}
502502

503503
func TestBuildPrivatelinkConn(t *testing.T) {
504+
os.Unsetenv(cacheServerURLEnv)
505+
os.Unsetenv(ocspRetryURLEnv)
506+
504507
if _, err := buildSnowflakeConn(context.Background(), Config{
505508
Account: "testaccount",
506509
User: "testuser",

put_get_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"bytes"
77
"compress/gzip"
88
"context"
9+
"database/sql"
910
"fmt"
1011
"io"
1112
"math/rand"
@@ -214,14 +215,14 @@ func TestPutLocalFile(t *testing.T) {
214215
dbt.mustExec(execQuery)
215216
dbt.mustQueryAssertCount("ls @%gotest_putget_t1", 2)
216217

217-
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9 string
218+
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9 sql.NullString
218219
rows := dbt.mustQuery("copy into gotest_putget_t1")
219220
defer func() {
220221
assertNilF(t, rows.Close())
221222
}()
222223
for rows.Next() {
223224
assertNilF(t, rows.Scan(&s0, &s1, &s2, &s3, &s4, &s5, &s6, &s7, &s8, &s9))
224-
if s1 != "LOADED" {
225+
if !s1.Valid || s1.String != "LOADED" {
225226
t.Fatal("not loaded")
226227
}
227228
}
@@ -244,7 +245,7 @@ func TestPutLocalFile(t *testing.T) {
244245
}()
245246
if rows3.Next() {
246247
assertNilF(t, rows3.Scan(&s0, &s1, &s2, &s3, &s4, &s5, &s6, &s7, &s8, &s9))
247-
if s1 != "LOADED" {
248+
if !s1.Valid || s1.String != "LOADED" {
248249
t.Fatal("not loaded")
249250
}
250251
}

put_get_with_aws_test.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"bytes"
77
"compress/gzip"
88
"context"
9+
"database/sql"
910
"encoding/json"
1011
"fmt"
1112
"io"
@@ -71,9 +72,9 @@ func TestLoadS3(t *testing.T) {
7172
field_optionally_enclosed_by='\"')`,
7273
data.awsAccessKeyID, data.awsSecretAccessKey))
7374
defer func() {
74-
assertNilF(t, rows.Close())
75+
assertNilF(t, rows.Close())
7576
}()
76-
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9 string
77+
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9 sql.NullString
7778
cnt := 0
7879
for rows.Next() {
7980
assertNilF(t, rows.Scan(&s0, &s1, &s2, &s3, &s4, &s5, &s6, &s7, &s8, &s9))
@@ -82,7 +83,7 @@ func TestLoadS3(t *testing.T) {
8283
if cnt != 1 {
8384
t.Fatal("copy into tweets did not set row count to 1")
8485
}
85-
if s0 != "s3://sfc-eng-data/twitter/O1k/tweets/1.csv.gz" {
86+
if !s0.Valid || s0.String != "s3://sfc-eng-data/twitter/O1k/tweets/1.csv.gz" {
8687
t.Fatalf("got %v as file", s0)
8788
}
8889
})
@@ -143,7 +144,7 @@ func TestPutWithInvalidToken(t *testing.T) {
143144
t.Error(err)
144145
}
145146
defer func() {
146-
assertNilF(t, f.Close())
147+
assertNilF(t, f.Close())
147148
}()
148149
uploader := manager.NewUploader(client)
149150
if _, err = uploader.Upload(context.Background(), &s3.PutObjectInput{
@@ -238,7 +239,7 @@ func TestPretendToPutButList(t *testing.T) {
238239
}
239240

240241
func TestPutGetAWSStage(t *testing.T) {
241-
if runningOnGithubAction() && !runningOnAWS() {
242+
if runningOnGithubAction() || !runningOnAWS() {
242243
t.Skip("skipping non aws environment")
243244
}
244245

@@ -275,7 +276,7 @@ func TestPutGetAWSStage(t *testing.T) {
275276
sqlText := fmt.Sprintf(sql, strings.ReplaceAll(fname, "\\", "\\\\"), stageName)
276277
rows := dbt.mustQuery(sqlText)
277278
defer func() {
278-
assertNilF(t, rows.Close())
279+
assertNilF(t, rows.Close())
279280
}()
280281

281282
var s0, s1, s2, s3, s4, s5, s6, s7 string
@@ -292,7 +293,7 @@ func TestPutGetAWSStage(t *testing.T) {
292293
sqlText = strings.ReplaceAll(sql, "\\", "\\\\")
293294
rows = dbt.mustQuery(sqlText)
294295
defer func() {
295-
assertNilF(t, rows.Close())
296+
assertNilF(t, rows.Close())
296297
}()
297298
for rows.Next() {
298299
if err = rows.Scan(&s0, &s1, &s2, &s3); err != nil {
@@ -323,7 +324,7 @@ func TestPutGetAWSStage(t *testing.T) {
323324
t.Error(err)
324325
}
325326
defer func() {
326-
assertNilF(t, f.Close())
327+
assertNilF(t, f.Close())
327328
}()
328329
gz, err := gzip.NewReader(f)
329330
if err != nil {

0 commit comments

Comments
 (0)