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()
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])
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()
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()
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()
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()