Skip to content

Commit 0f676e2

Browse files
committed
test: freed up resources
1 parent 9979c2f commit 0f676e2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/connection_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package e_tests
22

33
import (
4+
"context"
45
"fmt"
56
"strings"
67
"testing"
@@ -18,6 +19,7 @@ func TestConnection(t *testing.T) {
1819
client := e_connection.Connect(e_connection.ConnectionOptions{
1920
URI: strings.Replace(e_mocks.DEFAULT_DATASOURCE, e_mocks.DEFAULT_DB_NAME, t.Name(), 1),
2021
})
22+
defer client.Disconnect(context.Background())
2123
So(client, ShouldNotBeNil)
2224
Convey("Should use the default database", func() {
2325
So(e_connection.UseDefault().Name(), ShouldEqual, t.Name())
@@ -26,12 +28,14 @@ func TestConnection(t *testing.T) {
2628
DATABASE := fmt.Sprintf("%s_%s", t.Name(), "secondary")
2729
So(e_connection.Use(DATABASE).Name(), ShouldEqual, DATABASE)
2830
})
31+
2932
})
3033
Convey("Connect with a URI specified within client options", func() {
3134
opts := options.Client().ApplyURI(strings.Replace(e_mocks.DEFAULT_DATASOURCE, e_mocks.DEFAULT_DB_NAME, t.Name(), 1))
3235
client := e_connection.Connect(e_connection.ConnectionOptions{
3336
ClientOptions: opts,
3437
})
38+
defer client.Disconnect(context.Background())
3539
So(client, ShouldNotBeNil)
3640
})
3741
Convey("Connect with no URI", func() {

0 commit comments

Comments
 (0)