You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test_can_register_udt_before_connecting was flaky for a long time
we've pinpoint it to be the usage of set_keyspace
and in #299 we stop using set_keyspace
this is the test before the change, for reference:
def test_can_register_udt_before_connecting(self):
"""
Test the registration of UDTs before session creation
"""
c = TestCluster()
s = c.connect(wait_for_all_pools=True)
s.execute("""
CREATE KEYSPACE udt_test_register_before_connecting
WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1' }
""")
s.set_keyspace("udt_test_register_before_connecting")
s.execute("CREATE TYPE user (age int, name text)")
s.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<user>)")
s.execute("""
CREATE KEYSPACE udt_test_register_before_connecting2
WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor': '1' }
""")
s.set_keyspace("udt_test_register_before_connecting2")
s.execute("CREATE TYPE user (state text, is_cool boolean)")
s.execute("CREATE TABLE mytable (a int PRIMARY KEY, b frozen<user>)")
# now that types are defined, shutdown and re-create Cluster
c.shutdown()
c = TestCluster()
User1 = namedtuple('user', ('age', 'name'))
User2 = namedtuple('user', ('state', 'is_cool'))
c.register_user_type("udt_test_register_before_connecting", "user", User1)
c.register_user_type("udt_test_register_before_connecting2", "user", User2)
s = c.connect(wait_for_all_pools=True)
s.set_keyspace("udt_test_register_before_connecting")
s.execute("INSERT INTO mytable (a, b) VALUES (%s, %s)", (0, User1(42, 'bob')))
result = s.execute("SELECT b FROM mytable WHERE a=0")
row = result[0]
self.assertEqual(42, row.b.age)
self.assertEqual('bob', row.b.name)
self.assertTrue(type(row.b) is User1)
# use the same UDT name in a different keyspace
s.set_keyspace("udt_test_register_before_connecting2")
s.execute("INSERT INTO mytable (a, b) VALUES (%s, %s)", (0, User2('Texas', True)))
result = s.execute("SELECT b FROM mytable WHERE a=0")
row = result[0]
self.assertEqual('Texas', row.b.state)
self.assertEqual(True, row.b.is_cool)
self.assertTrue(type(row.b) is User2)
s.execute("DROP KEYSPACE udt_test_register_before_connecting")
s.execute("DROP KEYSPACE udt_test_register_before_connecting2")
the hypophysis I have, is that some connection (of some shard) might have been missed, and didn't got the USE command,
we don't have a mechanism to validate all connect got it, and that the next query can't be executed before they did
The text was updated successfully, but these errors were encountered:
test_can_register_udt_before_connecting
was flaky for a long timewe've pinpoint it to be the usage of
set_keyspace
and in #299 we stop using
set_keyspace
this is the test before the change, for reference:
the hypophysis I have, is that some connection (of some shard) might have been missed, and didn't got the
USE
command,we don't have a mechanism to validate all connect got it, and that the next query can't be executed before they did
The text was updated successfully, but these errors were encountered: