|
28 | 28 | from cassandra.graph.query import GraphProtocol |
29 | 29 | from cassandra.graph.types import VertexProperty |
30 | 30 |
|
| 31 | +from tests.util import wait_until |
31 | 32 | from tests.integration.advanced.graph import BasicGraphUnitTestCase, ClassicGraphFixtures, \ |
32 | 33 | ClassicGraphSchema, CoreGraphSchema |
33 | 34 | from tests.integration.advanced.graph import VertexLabel, GraphTestConfiguration, GraphUnitTestCase |
@@ -94,22 +95,26 @@ def _test_all_datatypes(self, schema, graphson): |
94 | 95 | schema.create_vertex_label(self.session, vertex_label, execution_profile=ep) |
95 | 96 | vertex = list(schema.add_vertex(self.session, vertex_label, property_name, value, execution_profile=ep))[0] |
96 | 97 |
|
97 | | - vertex_properties = list(schema.get_vertex_properties( |
98 | | - self.session, vertex, execution_profile=ep)) |
| 98 | + def get_vertex_properties(): |
| 99 | + return list(schema.get_vertex_properties( |
| 100 | + self.session, vertex, execution_profile=ep)) |
99 | 101 |
|
| 102 | + prop_returned = 1 if DSE_VERSION < Version('5.1') else 2 # include pkid >=5.1 |
| 103 | + wait_until( |
| 104 | + lambda: len(get_vertex_properties()) == prop_returned, 0.2, 15) |
| 105 | + |
| 106 | + vertex_properties = get_vertex_properties() |
100 | 107 | if graphson == GraphProtocol.GRAPHSON_1_0: |
101 | 108 | vertex_properties = [vp.as_vertex_property() for vp in vertex_properties] |
102 | 109 |
|
103 | | - prop_returned = 1 if DSE_VERSION < Version('5.1') else 2 # include pkid >=5.1 |
104 | | - self.assertEqual(len(vertex_properties), prop_returned) |
105 | 110 | for vp in vertex_properties: |
106 | 111 | if vp.label == 'pkid': |
107 | 112 | continue |
108 | 113 |
|
109 | 114 | self.assertIsInstance(vp, VertexProperty) |
110 | 115 | self.assertEqual(vp.label, property_name) |
111 | 116 | if graphson == GraphProtocol.GRAPHSON_1_0: |
112 | | - deserialized_value = deserializer(vp.value) |
| 117 | + deserialized_value = deserializer(vp.value) if deserializer else vp.value |
113 | 118 | self.assertEqual(deserialized_value, value) |
114 | 119 | else: |
115 | 120 | self.assertEqual(vp.value, value) |
@@ -171,10 +176,15 @@ def __test_udt(self, schema, graphson, address_class, address_with_tags_class, |
171 | 176 | schema.create_vertex_label(self.session, vertex_label, execution_profile=ep) |
172 | 177 |
|
173 | 178 | vertex = list(schema.add_vertex(self.session, vertex_label, property_name, value, execution_profile=ep))[0] |
174 | | - vertex_properties = list(schema.get_vertex_properties( |
175 | | - self.session, vertex, execution_profile=ep)) |
176 | 179 |
|
177 | | - self.assertEqual(len(vertex_properties), 2) # include pkid |
| 180 | + def get_vertex_properties(): |
| 181 | + return list(schema.get_vertex_properties( |
| 182 | + self.session, vertex, execution_profile=ep)) |
| 183 | + |
| 184 | + wait_until( |
| 185 | + lambda: len(get_vertex_properties()) == 2, 0.2, 15) |
| 186 | + |
| 187 | + vertex_properties = get_vertex_properties() |
178 | 188 | for vp in vertex_properties: |
179 | 189 | if vp.label == 'pkid': |
180 | 190 | continue |
|
0 commit comments