scylladb / python-driver

ScyllaDB Python Driver, originally DataStax Python Driver for Apache Cassandra

Home Page:https://python-driver.docs.scylladb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test_can_register_udt_before_connecting is failing on driver matrix run of 5.2

fruch opened this issue · comments

Test sometimes fails cliaming it's missing a IDT field

self = <tests.integration.standard.test_udts.UDTTests testMethod=test_can_register_udt_before_connecting>

    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)
E       AttributeError: 'user' object has no attribute 'state'

tests/integration/standard/test_udts.py:167: AttributeError

https://jenkins.scylladb.com/job/scylla-5.2/job/driver-tests/job/python-driver-matrix-test/11/

@Lorak-mmk can you give it a quick look ? have you seen this failure during trying to stabilize the integration suite ?

I'm not 100% sure, I think I saw this test fail once - but I didn't investigate it, as there were other tests failing more consistently.

Also failing on scylla-master