Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TestConcurrentReadOnParams cleaning up the connection too early #926

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
env:
PARAMETERS_SECRET: ${{ secrets.PARAMETERS_SECRET }}
CLOUD_PROVIDER: ${{ matrix.cloud }}
GORACE: history_size=7
sfc-gh-dheyman marked this conversation as resolved.
Show resolved Hide resolved
run: ./ci/test.sh
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
11 changes: 8 additions & 3 deletions connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,19 @@ func TestExecWithServerSideError(t *testing.T) {
}

func TestConcurrentReadOnParams(t *testing.T) {
t.Skip("Fails randomly")
config, err := ParseDSN(dsn)
if err != nil {
t.Fatal("Failed to parse dsn")
}
connector := NewConnector(SnowflakeDriver{}, *config)
db := sql.OpenDB(connector)
defer db.Close()
wg := sync.WaitGroup{}
for i := 0; i < 10; i++ {
wg.Add(1)
go func() {
for c := 0; c < 10; c++ {
stmt, err := db.PrepareContext(context.Background(), "SELECT * FROM information_schema.columns WHERE table_schema = ?")
stmt, err := db.PrepareContext(context.Background(), "SELECT table_schema FROM information_schema.columns WHERE table_schema = ? LIMIT 1")
if err != nil {
t.Error(err)
}
Expand All @@ -499,13 +499,18 @@ func TestConcurrentReadOnParams(t *testing.T) {
if rows == nil {
continue
}
rows.Next()
var tableName string
err = rows.Scan(&tableName)
if err != nil {
t.Error(err)
}
_ = rows.Close()
}
wg.Done()
}()
}
wg.Wait()
defer db.Close()
}

func postQueryTest(_ context.Context, _ *snowflakeRestful, _ *url.Values, headers map[string]string, _ []byte, _ time.Duration, _ UUID, _ *Config) (*execResponse, error) {
Expand Down
Loading