@@ -8,10 +8,10 @@ if err != nil {
8
8
}
9
9
10
10
options := &dockertest.RunOptions {
11
- Repository : " cassandra" ,
12
- Tag : " latest" ,
13
- Mounts : []string {" /tmp/local-cassandra:/etc/cassandra" },
14
- }
11
+ Repository : " cassandra" ,
12
+ Tag : " latest" ,
13
+ Mounts : []string {" /tmp/local-cassandra:/etc/cassandra" },
14
+ }
15
15
16
16
resource , err := pool.RunWithOptions (options)
17
17
if err != nil {
@@ -23,21 +23,21 @@ port, _ := strconv.Atoi(resource.GetPort("9042/tcp"))
23
23
24
24
// exponential backoff-retry, because the application in the container might not be ready to accept connections yet
25
25
if err := pool.Retry (func () error {
26
- clusterConfig := gocql.NewCluster (retURL)
27
- clusterConfig.Authenticator = gocql.PasswordAuthenticator {
28
- Username: " cassandra" ,
29
- Password: " cassandra" ,
30
- }
31
- clusterConfig.ProtoVersion = 4
32
- clusterConfig.Port = port
33
- log.Printf (" %v " , clusterConfig.Port )
26
+ clusterConfig := gocql.NewCluster (retURL)
27
+ clusterConfig.Authenticator = gocql.PasswordAuthenticator {
28
+ Username: " cassandra" ,
29
+ Password: " cassandra" ,
30
+ }
31
+ clusterConfig.ProtoVersion = 4
32
+ clusterConfig.Port = port
33
+ log.Printf (" %v " , clusterConfig.Port )
34
34
35
- session , err := clusterConfig.CreateSession ()
36
- if err != nil {
37
- return fmt.Errorf (" error creating session: %s " , err)
38
- }
35
+ session , err := clusterConfig.CreateSession ()
36
+ if err != nil {
37
+ return fmt.Errorf (" error creating session: %s " , err)
38
+ }
39
39
defer session.Close ()
40
- return nil
40
+ return nil
41
41
}); err != nil {
42
42
log.Fatalf (" Could not connect to docker: %s " , err)
43
43
}
0 commit comments