Files
scylladb/test/cqlpy/test_native_transport.py
Avi Kivity 0ae22a09d4 LICENSE: Update to version 1.1
Updated terms of non-commercial use (must be a never-customer).
2026-04-12 19:46:33 +03:00

32 lines
961 B
Python

# Copyright 2023-present ScyllaDB
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
import pytest
import time
from . import nodetool
from .util import new_test_table
from cassandra.cluster import NoHostAvailable
def test_enable_disable_binary(cql, test_keyspace):
schema = 'k text, v text, primary key (k)'
with new_test_table(cql, test_keyspace, schema) as table:
cql.execute(f"INSERT INTO {table} (k,v) VALUES ('foo', 'bar')")
cql.execute(f"SELECT * FROM {table}")
nodetool.disablebinary(cql)
with pytest.raises(NoHostAvailable):
cql.execute(f"SELECT * FROM {table}")
nodetool.enablebinary(cql)
pause = 0.1
while pause < 100:
try:
cql.execute(f"SELECT * FROM {table}")
break
except NoHostAvailable:
time.sleep(pause)
pause += pause
else:
assert False