Ejemplo n.º 1
0
 def test_keyspaces(self):
     with open("tests/resources/schema.cql", 'r') as f:
         schema = parse_schema(f.read())
         assert "system_auth" in schema.keys()
         assert "system" in schema.keys()
         assert "system_distributed" in schema.keys()
         assert "tlp_stress2" in schema.keys()
Ejemplo n.º 2
0
 def _restore_schema(self):
     schema = parse_schema(self.cluster_backup.schema)
     with self.session_provider.new_session() as session:
         for keyspace in schema.keys():
             if keyspace.startswith("system"):
                 continue
             else:
                 self._create_or_recreate_schema_objects(session, keyspace, schema[keyspace])
Ejemplo n.º 3
0
 def test_indices(self):
     with open("tests/resources/schema.cql", 'r') as f:
         schema = parse_schema(f.read())
         assert len(schema["system_auth"]["indices"].keys()) == 0
         assert len(schema["system"]["indices"].keys()) == 0
         assert len(schema["system_distributed"]["indices"].keys()) == 0
         assert len(schema["tlp_stress2"]["indices"].keys()) == 1
         assert "value_index" in schema["tlp_stress2"]["indices"].keys()
Ejemplo n.º 4
0
 def test_tables(self):
     with open("tests/resources/schema.cql", 'r') as f:
         schema = parse_schema(f.read())
         assert len(schema["system_auth"]["tables"].keys()) == 4
         assert len(schema["system"]["tables"].keys()) == 20
         assert len(schema["system_distributed"]["tables"].keys()) == 2
         assert len(schema["tlp_stress2"]["tables"].keys()) == 1
         assert "random_access" in schema["tlp_stress2"]["tables"].keys()
Ejemplo n.º 5
0
 def test_udf(self):
     with open("tests/resources/schema.cql", 'r') as f:
         schema = parse_schema(f.read())
         assert len(schema["system_auth"]["udt"].keys()) == 0
         assert len(schema["system"]["udt"].keys()) == 0
         assert len(schema["system_distributed"]["udt"].keys()) == 0
         assert len(schema["tlp_stress2"]["udt"].keys()) == 2
         assert "custom_type" in schema["tlp_stress2"]["udt"].keys()
         assert "custom_type2" in schema["tlp_stress2"]["udt"].keys()
Ejemplo n.º 6
0
 def test_mv(self):
     with open("tests/resources/schema.cql", 'r') as f:
         schema = parse_schema(f.read())
         assert len(schema["system_auth"]["materialized_views"].keys()) == 0
         assert len(schema["system"]["materialized_views"].keys()) == 0
         assert len(
             schema["system_distributed"]["materialized_views"].keys()) == 0
         assert len(schema["tlp_stress2"]["materialized_views"].keys()) == 1
         assert "random_access_by_value" in schema["tlp_stress2"][
             "materialized_views"].keys()