joao-r-reis commented on code in PR #1929:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1929#discussion_r2932363231
##########
cassandra_test.go:
##########
@@ -4397,3 +4405,28 @@ func TestHostInfoFromIter(t *testing.T) {
t.Errorf("unexpected non-missing rack")
}
}
+
+type mockSessionReadyListener struct {
+ readyCount int
+}
+
+func (l *mockSessionReadyListener) OnSessionReady() {
+ l.readyCount++
+}
+
+func TestSessionReadyEvent(t *testing.T) {
+ listener := &mockSessionReadyListener{}
+
+ // Don't use createSession helper because it creates session twice,
+ // once for creating test keyspace and once for the session itself
+ cluster := createCluster()
+ cluster.Metadata.SessionReadyListener = listener
+ session, err := cluster.CreateSession()
+ require.NoError(t, err)
+ defer session.Close()
+
+ require.Eventually(t, func() bool {
+ require.Equal(t, 1, listener.readyCount)
Review Comment:
I believe this should be a single `return listener.readyCount == 1`
otherwise it will not retry
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]