OleksiienkoMykyta commented on code in PR #1866: URL: https://github.com/apache/cassandra-gocql-driver/pull/1866#discussion_r2009825559
########## cassandra_test.go: ########## @@ -3955,3 +3955,46 @@ func TestRoutingKeyCacheUsesOverriddenKeyspace(t *testing.T) { session.Query("DROP KEYSPACE IF EXISTS gocql_test_routing_key_cache").Exec() } + +func TestTimeoutOverride(t *testing.T) { + session := createSession(t) + defer session.Close() + + if session.cfg.ProtoVersion < 3 { + t.Skip("named Values are not supported in protocol < 3") + } + + if err := createTable(session, "CREATE TABLE gocql_test.named_query(id int, value text, PRIMARY KEY (id))"); err != nil { + t.Fatal(err) + } + + // normal case + err := session.Query("INSERT INTO gocql_test.named_query(id, value) VALUES(1, 'value')").Exec() + if err != nil { + t.Fatal(err) + } + + //decrease Conn.timeout + session.executor.pool.mu.Lock() + for _, conPool := range session.executor.pool.hostConnPools { + conPool.mu.Lock() + for _, conn := range conPool.conns { + conn.r.SetTimeout(50) + } + conPool.mu.Unlock() + } + session.executor.pool.mu.Unlock() + err = session.Query("INSERT INTO gocql_test.named_query(id, value) VALUES(2, 'value')").Exec() + if err == nil || err != ErrTimeoutNoResponse { Review Comment: If you are expecting exactly ErrTimeoutNoResponse, this part is redundant "err == nil" wdyt? -- 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: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org