Skip to content

Commit 8421eff

Browse files
themilchenkooleg-jukovec
authored andcommitted
cluster: use tcs api calls in tests
It was CRUD requests to the config_storage space in integration tests for `tt cluster publish/show`. After the patch these tests use tcs API calls.
1 parent 62e6855 commit 8421eff

File tree

2 files changed

+20
-30
lines changed

2 files changed

+20
-30
lines changed

test/integration/cluster/test_cluster_publish.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -804,19 +804,17 @@ def test_cluster_publish_cluster(tt_cmd,
804804
if auth and instance_name == "etcd":
805805
instance.disable_auth()
806806
conn = instance.conn()
807-
get_response = ""
807+
content = ""
808808
if instance_name == "etcd":
809-
etcd_content, _ = conn.get("/prefix/config/all")
810-
get_response = etcd_content.decode("utf-8")
809+
content, _ = conn.get("/prefix/config/all")
810+
content = content.decode("utf-8")
811811
else:
812-
tcs_content = conn.select(
813-
space_name="config_storage", key="/prefix/config/all"
814-
)
812+
content = conn.call("config.storage.get", "/prefix/config/all")
815813
# We need first selected value with field 'value' which is 1st index.
816-
if len(tcs_content) > 0:
817-
get_response = tcs_content[0][1]
814+
if len(content) > 0:
815+
content = content[0]["data"][0]["value"]
818816
assert "" == publish_output
819-
assert valid_cluster_cfg == get_response
817+
assert valid_cluster_cfg == content
820818
finally:
821819
if instance_name == "etcd":
822820
instance.disable_auth()
@@ -884,9 +882,9 @@ def test_cluster_publish_instance(tt_cmd, tmpdir_with_cfg, instance_name, reques
884882
content, _ = conn.get("/prefix/config/all")
885883
content = content.decode("utf-8")
886884
else:
887-
content = conn.select(space_name="config_storage", key="/prefix/config/all")
885+
content = conn.call("config.storage.get", "/prefix/config/all")
888886
if len(content) > 0:
889-
content = content[0][1]
887+
content = content[0]["data"][0]["value"]
890888

891889
assert "" == publish_output
892890
assert valid_cluster_cfg.replace("3301", "3303") == content
@@ -955,9 +953,9 @@ def test_cluster_publish_key(tt_cmd, tmpdir_with_cfg, instance_name, request, fi
955953
content, _ = conn.get("/prefix/config/anykey")
956954
content = content.decode("utf-8")
957955
else:
958-
content = conn.select(space_name="config_storage", key="/prefix/config/anykey")
956+
content = conn.call("config.storage.get", "/prefix/config/anykey")
959957
if len(content) > 0:
960-
content = content[0][1]
958+
content = content[0]["data"][0]["value"]
961959

962960
assert "" == publish_output
963961
assert valid_cluster_cfg.replace("3301", "3303") == content
@@ -1041,7 +1039,9 @@ def test_cluster_publish_instance_not_exist(
10411039
content, _ = conn.get("/prefix/config/all")
10421040
content = content.decode("utf-8")
10431041
else:
1044-
content = conn.select(space_name="config_storage", key="/prefix/config/all")
1042+
content = conn.call("config.storage.get", "/prefix/config/all")
1043+
if len(content) > 0:
1044+
content = content[0]["data"][0]["value"]
10451045
assert (
10461046
"""groups:
10471047
group-001:

test/integration/cluster/test_cluster_show.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,7 @@ def test_cluster_show_config_cluster(
439439
if instance_name == "etcd":
440440
conn.put("/prefix/config/all", config)
441441
else:
442-
conn.insert(
443-
space_name="config_storage", values=["/prefix/config/all", config, 2]
444-
)
442+
conn.call("config.storage.put", "/prefix/config/all", config)
445443

446444
if auth and instance_name == "etcd":
447445
instance.enable_auth()
@@ -530,9 +528,7 @@ def test_cluster_show_config_instance(tt_cmd,
530528
if instance_name == "etcd":
531529
conn.put("/prefix/config/", config)
532530
else:
533-
conn.insert(
534-
space_name="config_storage", values=["/prefix/config/all", config, 2]
535-
)
531+
conn.call("config.storage.put", "/prefix/config/all", config)
536532
creds = (
537533
f"{instance.connection_username}:{instance.connection_password}@"
538534
if instance_name == "tcs"
@@ -577,10 +573,7 @@ def test_cluster_show_config_key(tt_cmd, tmpdir_with_cfg, instance_name, request
577573
if instance_name == "etcd":
578574
conn.put("/prefix/config/anykey", valid_cluster_cfg)
579575
else:
580-
conn.insert(
581-
space_name="config_storage",
582-
values=["/prefix/config/anykey", valid_cluster_cfg, 2],
583-
)
576+
conn.call("config.storage.put", "/prefix/config/anykey", valid_cluster_cfg)
584577
creds = (
585578
f"{instance.connection_username}:{instance.connection_password}@"
586579
if instance_name == "tcs"
@@ -622,10 +615,7 @@ def test_cluster_show_config_key_instance(
622615
if instance_name == "etcd":
623616
conn.put("/prefix/config/anykey", valid_cluster_cfg)
624617
else:
625-
conn.insert(
626-
space_name="config_storage",
627-
values=["/prefix/config/anykey", valid_cluster_cfg, 2],
628-
)
618+
conn.call("config.storage.put", "/prefix/config/anykey", valid_cluster_cfg)
629619
creds = (
630620
f"{instance.connection_username}:{instance.connection_password}@"
631621
if instance_name == "tcs"
@@ -676,9 +666,9 @@ def test_cluster_show_config_no_instance(
676666
instances:
677667
"""
678668
if instance_name == "etcd":
679-
conn.put("/prefix/config/", config)
669+
conn.put("/prefix/config/all", config)
680670
else:
681-
conn.insert(space_name="config_storage", values=["/prefix/config/", config, 2])
671+
conn.call("config.storage.put", "/prefix/config/all", config)
682672
creds = (
683673
f"{instance.connection_username}:{instance.connection_password}@"
684674
if instance_name == "tcs"

0 commit comments

Comments
 (0)