Skip to content

Commit

Permalink
Merge pull request #1497 from pablomatiasgomez/reduce-memory-usage-co…
Browse files Browse the repository at this point in the history
…mpressor

change container provider, verify close conn error in tests
  • Loading branch information
SpencerTorres authored Feb 14, 2025
2 parents 88b9368 + f6fa3c1 commit 029b2d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ func (c *connect) close() error {
}

c.buffer = nil
c.compressor = nil

c.readerMutex.Lock()
c.reader = nil
Expand Down
5 changes: 2 additions & 3 deletions tests/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,7 @@ func TestConnectionExpiresIdleConnection(t *testing.T) {
defer wg.Done()
r, err := conn.Query(ctx, "SELECT 1")
require.NoError(t, err)

r.Close()
require.NoError(t, r.Close())
}()
}
wg.Wait()
Expand Down Expand Up @@ -390,8 +389,8 @@ func TestConnectionCloseIdle(t *testing.T) {
conn, err := TestClientWithDefaultSettings(testEnv)
require.NoError(t, err)
err = conn.Ping(ctx)
conn.Close()
require.NoError(t, err)
require.NoError(t, conn.Close())
}
time.Sleep(100 * time.Millisecond) // wait for all connections closed
finalGoroutine := runtime.NumGoroutine()
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func CreateClickHouseTestEnvironment(testSet string) (ClickHouseTestEnvironment,
// create a ClickHouse Container
ctx := context.Background()
// attempt use docker for CI
provider, err := testcontainers.ProviderDocker.GetProvider()
provider, err := testcontainers.ProviderDefault.GetProvider()
if err != nil {
fmt.Printf("Docker is not running and no clickhouse connections details were provided. Skipping tests: %s\n", err)
os.Exit(0)
Expand Down

0 comments on commit 029b2d8

Please sign in to comment.