Files
scylladb/test/cql-pytest/test_virtual_tables.py
Avi Kivity fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00

35 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2021-present ScyllaDB
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import pytest
import util
import nodetool
def test_snapshots_table(scylla_only, cql, test_keyspace):
with util.new_test_table(cql, test_keyspace, 'pk int PRIMARY KEY, v int') as table:
cql.execute(f"INSERT INTO {table} (pk, v) VALUES (0, 0)")
nodetool.take_snapshot(cql, table, 'my_tag', False)
res = list(cql.execute(f"SELECT keyspace_name, table_name, snapshot_name, live, total FROM system.snapshots"))
assert len(res) == 1
ks, tbl = table.split('.')
assert res[0][0] == ks
assert res[0][1] == tbl
assert res[0][2] == 'my_tag'
# We only want to check that the table exists with the listed columns, to assert
# backwards compatibility.
def _check_exists(cql, table_name, columns):
cols = ", ".join(columns)
assert list(cql.execute(f"SELECT {cols} FROM system.{table_name}"))
def test_protocol_servers(scylla_only, cql):
_check_exists(cql, "protocol_servers", ("name", "listen_addresses", "protocol", "protocol_version"))
def test_runtime_info(scylla_only, cql):
_check_exists(cql, "runtime_info", ("group", "item", "value"))
def test_versions(scylla_only, cql):
_check_exists(cql, "versions", ("key", "build_id", "build_mode", "version"))