Skip to content

Commit 9c34737

Browse files
committed
test:connect all nodes
1 parent 737f415 commit 9c34737

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ module github.com/gocql/gocql
2020
go 1.23
2121

2222
require (
23-
github.com/bitly/go-hostpool v0.1.0 // indirect
24-
github.com/docker/docker v27.1.1+incompatible // indirect
2523
github.com/golang/snappy v0.0.4
2624
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed
2725
github.com/testcontainers/testcontainers-go v0.33.0
@@ -32,13 +30,15 @@ require (
3230
dario.cat/mergo v1.0.0 // indirect
3331
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
3432
github.com/Microsoft/go-winio v0.6.2 // indirect
33+
github.com/bitly/go-hostpool v0.1.0 // indirect
3534
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
3635
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
3736
github.com/containerd/containerd v1.7.18 // indirect
3837
github.com/containerd/log v0.1.0 // indirect
3938
github.com/containerd/platforms v0.2.1 // indirect
4039
github.com/cpuguy83/dockercfg v0.3.1 // indirect
4140
github.com/distribution/reference v0.6.0 // indirect
41+
github.com/docker/docker v27.1.1+incompatible // indirect
4242
github.com/docker/go-connections v0.5.0 // indirect
4343
github.com/docker/go-units v0.5.0 // indirect
4444
github.com/felixge/httpsnoop v1.0.4 // indirect

integration_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,28 @@ func TestUDF(t *testing.T) {
272272
t.Fatal(err)
273273
}
274274
}
275+
276+
func TestAllNodesConnected(t *testing.T) {
277+
cluster := createCluster()
278+
cluster.PoolConfig.HostSelectionPolicy = RoundRobinHostPolicy()
279+
280+
session := createSessionFromCluster(cluster, t)
281+
defer session.Close()
282+
283+
ids := make(map[string]bool)
284+
285+
// Loop to query system.local multiple times. If there is a cluster with more than 10 nodes add to the loop more iterations
286+
for i := 0; i < 10; i++ {
287+
var hostID string
288+
err := session.Query("SELECT host_id FROM system.local").Scan(&hostID)
289+
if err != nil {
290+
t.Fatal(err)
291+
}
292+
293+
ids[hostID] = true
294+
}
295+
296+
if *clusterSize != len(ids) {
297+
t.Fatalf("Expected to connect to %d unique nodes", *clusterSize)
298+
}
299+
}

0 commit comments

Comments
 (0)