Merge pull request #57146 from vitlibar/fix-test_replicated_merge_tree_encryption_codec_different_keys_2

Fix test test_replicated_merge_tree_encryption_codec/test.py::test_different_keys
This commit is contained in:
Vitaly Baranov 2023-11-25 09:36:33 +01:00 committed by GitHub
commit 4fed61e8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,9 +91,14 @@ def test_different_keys():
copy_keys(node2, "key_b")
create_table()
insert_data()
# Insert two blocks without duplicated blocks to force each replica to actually fetch parts from another replica.
node1.query("INSERT INTO tbl VALUES (1, 'str1')")
node2.query("INSERT INTO tbl VALUES (2, 'str2')")
node1.query("SYSTEM SYNC REPLICA ON CLUSTER 'cluster' tbl")
# After "SYSTEM SYNC REPLICA" we expect node1 and node2 here both having a part for (1, 'str1') encrypted with "key_a",
# and a part for (2, 'str2') encrypted with "key_b".
# So the command "SELECT * from tbl" must fail on both nodes because each node has only one encryption key.
assert "BAD_DECRYPT" in node1.query_and_get_error("SELECT * FROM tbl")
assert "BAD_DECRYPT" in node2.query_and_get_error("SELECT * FROM tbl")