diff --git a/parquet/tests/file.py b/parquet/tests/file.py index ac52b8140..1c14f076b 100644 --- a/parquet/tests/file.py +++ b/parquet/tests/file.py @@ -47,8 +47,8 @@ def insert_into_engine(self): ) with Check("I check the data inserted into a new table"): - table1 = node.query(f"SELECT * FROM {table_name_merge_tree}") - table2 = node.query(f"SELECT * FROM {table_name_parquet_file}") + table1 = node.query(f"SELECT * FROM {table_name_merge_tree} FORMAT TabSeparated") + table2 = node.query(f"SELECT * FROM {table_name_parquet_file} FORMAT TabSeparated") assert table1.output.strip() == table2.output.strip(), error() with Check( diff --git a/rbac/tests/privileges/dictGet.py b/rbac/tests/privileges/dictGet.py index 47ecc1e58..0ab9ad402 100644 --- a/rbac/tests/privileges/dictGet.py +++ b/rbac/tests/privileges/dictGet.py @@ -116,7 +116,7 @@ def dictGet_check(self, privilege, on, grant_target_name, user_name, node=None): with Then("I attempt to dictGet without privilege"): node.query( - f"SELECT dictGet ({dict_name},'y',toUInt64(1))", + f"SELECT dictGet ({dict_name},'y',toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -129,7 +129,7 @@ def dictGet_check(self, privilege, on, grant_target_name, user_name, node=None): with Then("I attempt to dictGet with privilege"): node.query( - f"SELECT dictGet ({dict_name},'y',toUInt64(1))", + f"SELECT dictGet ({dict_name},'y',toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], ) @@ -143,7 +143,7 @@ def dictGet_check(self, privilege, on, grant_target_name, user_name, node=None): with When("I attempt to dictGet without privilege"): node.query( - f"SELECT dictGet ({dict_name},'y',toUInt64(1))", + f"SELECT dictGet ({dict_name},'y',toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -236,7 +236,7 @@ def dictGetOrDefault_check( with Then("I attempt to dictGetOrDefault without privilege"): node.query( - f"SELECT dictGetOrDefault ({dict_name},'y',toUInt64(1),toUInt64(1))", + f"SELECT dictGetOrDefault ({dict_name},'y',toUInt64(1),toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -249,7 +249,7 @@ def dictGetOrDefault_check( with Then("I attempt to dictGetOrDefault with privilege"): node.query( - f"SELECT dictGetOrDefault ({dict_name},'y',toUInt64(1),toUInt64(1))", + f"SELECT dictGetOrDefault ({dict_name},'y',toUInt64(1),toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], ) @@ -263,7 +263,7 @@ def dictGetOrDefault_check( with When("I attempt to dictGetOrDefault without privilege"): node.query( - f"SELECT dictGetOrDefault ({dict_name},'y',toUInt64(1),toUInt64(1))", + f"SELECT dictGetOrDefault ({dict_name},'y',toUInt64(1),toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -354,7 +354,7 @@ def dictHas_check(self, privilege, on, grant_target_name, user_name, node=None): with Then("I attempt to dictHas without privilege"): node.query( - f"SELECT dictHas({dict_name},toUInt64(1))", + f"SELECT dictHas({dict_name},toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -367,7 +367,7 @@ def dictHas_check(self, privilege, on, grant_target_name, user_name, node=None): with Then("I attempt to dictHas with privilege"): node.query( - f"SELECT dictHas({dict_name},toUInt64(1))", + f"SELECT dictHas({dict_name},toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], ) @@ -381,7 +381,7 @@ def dictHas_check(self, privilege, on, grant_target_name, user_name, node=None): with When("I attempt to dictHas without privilege"): node.query( - f"SELECT dictHas({dict_name},toUInt64(1))", + f"SELECT dictHas({dict_name},toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -474,7 +474,7 @@ def dictGetHierarchy_check( with Then("I attempt to dictGetHierarchy without privilege"): node.query( - f"SELECT dictGetHierarchy({dict_name},toUInt64(1))", + f"SELECT dictGetHierarchy({dict_name},toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -487,7 +487,7 @@ def dictGetHierarchy_check( with Then("I attempt to dictGetHierarchy with privilege"): node.query( - f"SELECT dictGetHierarchy({dict_name},toUInt64(1))", + f"SELECT dictGetHierarchy({dict_name},toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], ) @@ -501,7 +501,7 @@ def dictGetHierarchy_check( with When("I attempt to dictGetHierarchy without privilege"): node.query( - f"SELECT dictGetHierarchy({dict_name},toUInt64(1))", + f"SELECT dictGetHierarchy({dict_name},toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -592,7 +592,7 @@ def dictIsIn_check(self, privilege, on, grant_target_name, user_name, node=None) with Then("I attempt to dictIsIn without privilege"): node.query( - f"SELECT dictIsIn({dict_name},toUInt64(1),toUInt64(1))", + f"SELECT dictIsIn({dict_name},toUInt64(1),toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -605,7 +605,7 @@ def dictIsIn_check(self, privilege, on, grant_target_name, user_name, node=None) with Then("I attempt to dictIsIn with privilege"): node.query( - f"SELECT dictIsIn({dict_name},toUInt64(1),toUInt64(1))", + f"SELECT dictIsIn({dict_name},toUInt64(1),toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], ) @@ -619,7 +619,7 @@ def dictIsIn_check(self, privilege, on, grant_target_name, user_name, node=None) with When("I attempt to dictIsIn without privilege"): node.query( - f"SELECT dictIsIn({dict_name},toUInt64(1),toUInt64(1))", + f"SELECT dictIsIn({dict_name},toUInt64(1),toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -750,7 +750,7 @@ def dictGetType_check( with Then("I attempt to dictGet without privilege"): node.query( - f"SELECT dictGet{type}({dict_name},'z',toUInt64(1))", + f"SELECT dictGet{type}({dict_name},'z',toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -763,7 +763,7 @@ def dictGetType_check( with Then("I attempt to dictGet with privilege"): node.query( - f"SELECT dictGet{type}({dict_name},'z',toUInt64(1))", + f"SELECT dictGet{type}({dict_name},'z',toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], ) @@ -777,7 +777,7 @@ def dictGetType_check( with When("I attempt to dictGet without privilege"): node.query( - f"SELECT dictGet{type}({dict_name},'z',toUInt64(1))", + f"SELECT dictGet{type}({dict_name},'z',toUInt64(1)) FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, diff --git a/rbac/tests/privileges/distributed_table.py b/rbac/tests/privileges/distributed_table.py index 0303f5a52..e57a021b3 100755 --- a/rbac/tests/privileges/distributed_table.py +++ b/rbac/tests/privileges/distributed_table.py @@ -314,7 +314,7 @@ def select_without_privilege(self, node=None): with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -384,7 +384,7 @@ def select_with_privilege(self, user_name, grant_target_name, node=None): with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -398,7 +398,7 @@ def select_with_privilege(self, user_name, grant_target_name, node=None): with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -409,7 +409,7 @@ def select_with_privilege(self, user_name, grant_target_name, node=None): with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -475,7 +475,7 @@ def select_with_privilege(self, user_name, grant_target_name, node=None): with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -753,7 +753,7 @@ def select_with_table_on_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -764,7 +764,7 @@ def select_with_table_on_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -778,7 +778,7 @@ def select_with_table_on_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -789,7 +789,7 @@ def select_with_table_on_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) with When("I revoke ALL privileges"): @@ -797,7 +797,7 @@ def select_with_table_on_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -808,7 +808,7 @@ def select_with_table_on_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -893,7 +893,7 @@ def select_with_table_on_source_table_of_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -907,7 +907,7 @@ def select_with_table_on_source_table_of_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -918,7 +918,7 @@ def select_with_table_on_source_table_of_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) with When("I revoke ALL privileges"): @@ -937,7 +937,7 @@ def select_with_table_on_source_table_of_materialized_view( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -1031,7 +1031,7 @@ def select_with_table_on_distributed_table( "I attempt to select from the distributed table as the user" ): node.query( - f"SELECT * FROM {table2_name}", + f"SELECT * FROM {table2_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -1048,7 +1048,7 @@ def select_with_table_on_distributed_table( ): with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table2_name}", + f"SELECT * FROM {table2_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], ) @@ -1057,7 +1057,7 @@ def select_with_table_on_distributed_table( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table2_name}", + f"SELECT * FROM {table2_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -1068,7 +1068,7 @@ def select_with_table_on_distributed_table( with Then("I attempt to select from the distributed table as the user"): node.query( - f"SELECT * FROM {table2_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table2_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -1548,7 +1548,7 @@ def local_user(self, cluster, node=None): with Then("I select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) with When("I revoke ALL privileges"): @@ -1559,7 +1559,7 @@ def local_user(self, cluster, node=None): with Then("I select from the distributed table as the user"): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -1612,14 +1612,14 @@ def multiple_node_user(self, node=None): "I select from the distributed table on the node where the user has privileges" ): node.query( - f"SELECT * FROM {table1_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) with And( "I select from the distributed table on the node the user doesn't have privileges" ): node2.query( - f"SELECT * FROM {table1_name}", + f"SELECT * FROM {table1_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, diff --git a/rbac/tests/privileges/grant_drop_user_race.py b/rbac/tests/privileges/grant_drop_user_race.py index da37cc2f7..943bf4915 100644 --- a/rbac/tests/privileges/grant_drop_user_race.py +++ b/rbac/tests/privileges/grant_drop_user_race.py @@ -70,12 +70,12 @@ def feature(self, stress=None, node="clickhouse1"): with Finally(f"I check if {user0_name} succesfully gained privileges."): if self.context.privilege: node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", user0_name)], ) else: node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", message="DB::Exception: user0_grant_drop_user_race", exitcode=241, settings=[("user", user0_name)], diff --git a/rbac/tests/privileges/orphaned_role.py b/rbac/tests/privileges/orphaned_role.py index 0917eeb38..90a169ee1 100644 --- a/rbac/tests/privileges/orphaned_role.py +++ b/rbac/tests/privileges/orphaned_role.py @@ -46,7 +46,7 @@ def feature(self, stress=None, node="clickhouse1"): with Then(f"I try to SELECT from {table_name} as {user_name}"): node.query( - f"SELECT * FROM {table_name}", settings=[("user", user_name)] + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)] ) with Finally(f"I remove {table_name}"): diff --git a/rbac/tests/privileges/public_tables.py b/rbac/tests/privileges/public_tables.py index 43c52c0a7..4e5bb0fd6 100755 --- a/rbac/tests/privileges/public_tables.py +++ b/rbac/tests/privileges/public_tables.py @@ -20,23 +20,23 @@ def public_tables(self, node=None): with user(node, f"{user_name}"): with When("I check the user is able to select on system.one"): node.query( - "SELECT count(*) FROM system.one", settings=[("user", user_name)] + "SELECT count(*) FROM system.one FORMAT TabSeparated", settings=[("user", user_name)] ) with And("I check the user is able to select on system.numbers"): node.query( - "SELECT * FROM system.numbers LIMIT 1", settings=[("user", user_name)] + "SELECT * FROM system.numbers LIMIT 1 FORMAT TabSeparated", settings=[("user", user_name)] ) with And("I check the user is able to select on system.contributors"): node.query( - "SELECT count(*) FROM system.contributors", + "SELECT count(*) FROM system.contributors FORMAT TabSeparated", settings=[("user", user_name)], ) with And("I check the user is able to select on system.functions"): node.query( - "SELECT count(*) FROM system.functions", settings=[("user", user_name)] + "SELECT count(*) FROM system.functions FORMAT TabSeparated", settings=[("user", user_name)] ) @@ -52,83 +52,83 @@ def sensitive_tables(self, node=None): with user(node, f"{user_name}"): with Given("I create a query"): - node.query("SELECT 1") + node.query("SELECT 1 FORMAT TabSeparated") with When("I select from processes"): output = node.query( - "SELECT count(*) FROM system.processes", settings=[("user", user_name)] + "SELECT count(*) FROM system.processes FORMAT TabSeparated", settings=[("user", user_name)] ).output assert output == 0, error() with And("I select from query_log"): output = node.query( - "SELECT count(*) FROM system.query_log", settings=[("user", user_name)] + "SELECT count(*) FROM system.query_log FORMAT TabSeparated", settings=[("user", user_name)] ).output assert output == 0, error() with And("I select from query_thread_log"): output = node.query( - "SELECT count(*) FROM system.query_thread_log", + "SELECT count(*) FROM system.query_thread_log FORMAT TabSeparated", settings=[("user", user_name)], ).output assert output == 0, error() with And("I select from query_views_log"): output = node.query( - "SELECT count(*) FROM system.query_views_log", + "SELECT count(*) FROM system.query_views_log FORMAT TabSeparated", settings=[("user", user_name)], ).output assert output == 0, error() with And("I select from clusters"): output = node.query( - "SELECT count(*) FROM system.clusters", settings=[("user", user_name)] + "SELECT count(*) FROM system.clusters FORMAT TabSeparated", settings=[("user", user_name)] ).output assert output == 0, error() with And("I select from events"): output = node.query( - "SELECT count(*) FROM system.events", settings=[("user", user_name)] + "SELECT count(*) FROM system.events FORMAT TabSeparated", settings=[("user", user_name)] ).output assert output == 0, error() with And("I select from graphite_retentions"): output = node.query( - "SELECT count(*) FROM system.graphite_retentions", + "SELECT count(*) FROM system.graphite_retentions FORMAT TabSeparated", settings=[("user", user_name)], ).output assert output == 0, error() with And("I select from stack_trace"): output = node.query( - "SELECT count(*) FROM system.stack_trace", + "SELECT count(*) FROM system.stack_trace FORMAT TabSeparated", settings=[("user", user_name)], ).output assert output == 0, error() with And("I select from trace_log"): output = node.query( - "SELECT count(*) FROM system.trace_log", settings=[("user", user_name)] + "SELECT count(*) FROM system.trace_log FORMAT TabSeparated", settings=[("user", user_name)] ).output assert output == 0, error() with And("I select from user_directories"): output = node.query( - "SELECT count(*) FROM system.user_directories", + "SELECT count(*) FROM system.user_directories FORMAT TabSeparated", settings=[("user", user_name)], ).output assert output == 0, error() with And("I select from zookeeper"): output = node.query( - "SELECT count(*) FROM system.zookeeper WHERE path = '/clickhouse' ", + "SELECT count(*) FROM system.zookeeper WHERE path = '/clickhouse' FORMAT TabSeparated", settings=[("user", user_name)], ).output assert output == 0, error() with And("I select from macros"): output = node.query( - "SELECT count(*) FROM system.macros", settings=[("user", user_name)] + "SELECT count(*) FROM system.macros FORMAT TabSeparated", settings=[("user", user_name)] ).output assert output == 0, error() diff --git a/rbac/tests/privileges/select.py b/rbac/tests/privileges/select.py index 6614a1da5..b1afea1f9 100755 --- a/rbac/tests/privileges/select.py +++ b/rbac/tests/privileges/select.py @@ -31,7 +31,7 @@ def without_privilege(self, table_type, node=None): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -60,7 +60,7 @@ def user_with_privilege(self, table_type, node=None): with Then("I verify SELECT command"): user_select = node.query( - f"SELECT d FROM {table_name}", settings=[("user", user_name)] + f"SELECT d FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)] ) default = node.query(f"SELECT d FROM {table_name}") @@ -87,10 +87,10 @@ def user_with_all_privilege(self, table_type, node=None): with Then("I verify SELECT command"): user_select = node.query( - f"SELECT d FROM {table_name}", settings=[("user", user_name)] + f"SELECT d FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)] ) - default = node.query(f"SELECT d FROM {table_name}") + default = node.query(f"SELECT d FROM {table_name} FORMAT TabSeparated") assert user_select.output == default.output, error() @@ -119,7 +119,7 @@ def user_with_revoked_privilege(self, table_type, node=None): with Then("I use SELECT, throws exception"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -148,7 +148,7 @@ def user_with_revoked_all_privilege(self, table_type, node=None): with Then("I use SELECT, throws exception"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -214,7 +214,7 @@ def user_column_privileges( with And("I select from not granted column"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT ({select_columns_fail}) FROM {table_name}", + f"SELECT ({select_columns_fail}) FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -222,7 +222,7 @@ def user_column_privileges( with Then("I select from granted column, verify correct result"): user_select = node.query( - f"SELECT ({select_columns_pass}) FROM {table_name}", + f"SELECT ({select_columns_pass}) FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], ) default = node.query(f"SELECT ({select_columns_pass}) FROM {table_name}") @@ -237,7 +237,7 @@ def user_column_privileges( with And("I select from revoked columns"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT ({select_columns_pass}) FROM {table_name}", + f"SELECT ({select_columns_pass}) FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -273,7 +273,7 @@ def role_with_privilege(self, table_type, node=None): with Then("I verify SELECT command"): user_select = node.query( - f"SELECT d FROM {table_name}", settings=[("user", user_name)] + f"SELECT d FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)] ) default = node.query(f"SELECT d FROM {table_name}") assert user_select.output == default.output, error() @@ -308,7 +308,7 @@ def role_with_revoked_privilege(self, table_type, node=None): with And("I select from the table"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -341,7 +341,7 @@ def user_with_revoked_role(self, table_type, node=None): with And("I select from the table"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -414,7 +414,7 @@ def role_column_privileges( with And("I select from not granted column"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT ({select_columns_fail}) FROM {table_name}", + f"SELECT ({select_columns_fail}) FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -422,7 +422,7 @@ def role_column_privileges( with Then("I verify SELECT command"): user_select = node.query( - f"SELECT d FROM {table_name}", settings=[("user", user_name)] + f"SELECT d FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)] ) default = node.query(f"SELECT d FROM {table_name}") assert user_select.output == default.output, error() @@ -436,7 +436,7 @@ def role_column_privileges( with And("I select from revoked columns"): exitcode, message = errors.not_enough_privileges(name=user_name) node.query( - f"SELECT ({select_columns_pass}) FROM {table_name}", + f"SELECT ({select_columns_pass}) FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)], exitcode=exitcode, message=message, @@ -475,9 +475,9 @@ def user_with_privilege_on_cluster(self, table_type, node=None): with Then("I verify SELECT command"): user_select = node.query( - f"SELECT d FROM {table_name}", settings=[("user", user_name)] + f"SELECT d FROM {table_name} FORMAT TabSeparated", settings=[("user", user_name)] ) - default = node.query(f"SELECT d FROM {table_name}") + default = node.query(f"SELECT d FROM {table_name} FORMAT TabSeparated") assert user_select.output == default.output, error() finally: diff --git a/rbac/tests/privileges/system/shutdown.py b/rbac/tests/privileges/system/shutdown.py index 11cb6c252..4b942ccbd 100644 --- a/rbac/tests/privileges/system/shutdown.py +++ b/rbac/tests/privileges/system/shutdown.py @@ -122,7 +122,7 @@ def shutdown(self, privilege, grant_target_name, user_name, node=None): node.close_bashes() with And("I check that system is down"): - command = f'echo -e "SELECT 1" | {cluster.docker_compose} exec -T {node.name} clickhouse client -n' + command = f'echo -e "SELECT 1 FORMAT TabSeparated" | {cluster.docker_compose} exec -T {node.name} clickhouse client -n' start_time = time.time() @@ -197,7 +197,7 @@ def kill(self, privilege, grant_target_name, user_name, node=None): node.close_bashes() with And("I check that system is down"): - command = f'echo -e "SELECT 1" | {cluster.docker_compose} exec -T {node.name} clickhouse client -n' + command = f'echo -e "SELECT 1 FORMAT TabSeparated" | {cluster.docker_compose} exec -T {node.name} clickhouse client -n' start_time = time.time() diff --git a/rbac/tests/privileges/table_functions.py b/rbac/tests/privileges/table_functions.py index c089ac2ed..e181286e3 100644 --- a/rbac/tests/privileges/table_functions.py +++ b/rbac/tests/privileges/table_functions.py @@ -41,7 +41,7 @@ def remote(self, node=None): f"I try to select from the table using remote table function as {user_name}" ): node.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -55,7 +55,7 @@ def remote(self, node=None): f"I try to select from the table using remote table function as {user_name}" ): node.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -76,7 +76,7 @@ def remote(self, node=None): "I try to select from the table as the same user, but from clickhouse2" ): node2.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -92,7 +92,7 @@ def remote(self, node=None): "I try to select from the table as the same user, but from clickhouse2" ): node2.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -105,7 +105,7 @@ def remote(self, node=None): f"I successfully select from the remote table as {user_name} from clickhouse2" ): output = node2.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", settings=[("user", f"{user_name}")], ).output assert output == default, error() @@ -114,7 +114,7 @@ def remote(self, node=None): "I try to select from the table as the same user, but from clickhouse3" ): node3.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -130,7 +130,7 @@ def remote(self, node=None): "I try to select from the table as the same user, but from clickhouse3" ): node3.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -143,7 +143,7 @@ def remote(self, node=None): f"I successfully select from the remote table as {user_name} from clickhouse3" ): output = node3.query( - f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + f"SELECT * FROM remote(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", settings=[("user", f"{user_name}")], ).output assert output == default, error() @@ -190,7 +190,7 @@ def cluster(self, node=None): f"I try to select from the table using cluster table function as {user_name}" ): node.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -204,7 +204,7 @@ def cluster(self, node=None): f"I try to select from the table using cluster table function as {user_name}" ): node.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -215,7 +215,7 @@ def cluster(self, node=None): with And(f"I successfully select from the cluster table as {user_name}"): output = node.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", settings=[("user", f"{user_name}")], ).output default = node.query(f"SELECT * FROM {table_name}").output @@ -225,7 +225,7 @@ def cluster(self, node=None): "I try to select from the table as the same user, but from clickhouse2" ): node2.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -241,7 +241,7 @@ def cluster(self, node=None): "I try to select from the table as the same user, but from clickhouse2" ): node2.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -254,7 +254,7 @@ def cluster(self, node=None): f"I successfully select from the cluster table as {user_name} from clickhouse2" ): output = node2.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", settings=[("user", f"{user_name}")], ).output assert output == default, error() @@ -263,7 +263,7 @@ def cluster(self, node=None): "I try to select from the table as the same user, but from clickhouse3" ): node3.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -279,7 +279,7 @@ def cluster(self, node=None): "I try to select from the table as the same user, but from clickhouse3" ): node3.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", exitcode=exitcode, message=message, settings=[("user", f"{user_name}")], @@ -292,7 +292,7 @@ def cluster(self, node=None): f"I successfully select from the cluster table as {user_name} from clickhouse3" ): output = node3.query( - f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name}) FORMAT TabSeparated", settings=[("user", f"{user_name}")], ).output assert output == default, error() diff --git a/rbac/tests/views/live_view.py b/rbac/tests/views/live_view.py index d4ee8f13c..32c1061ea 100755 --- a/rbac/tests/views/live_view.py +++ b/rbac/tests/views/live_view.py @@ -267,7 +267,7 @@ def create_with_source_table_privilege(self, user_name, grant_target_name, node= ) with Then("I check the view"): - output = node.query(f"SELECT count(*) FROM {view_name}").output + output = node.query(f"SELECT count(*) FROM {view_name} FORMAT TabSeparated").output assert output == "0", error() finally: @@ -793,7 +793,7 @@ def select_without_select_privilege(self, node=None): with Then("I try to select from view without privilege as the user"): node.query( - f"SELECT * FROM {view_name}", + f"SELECT * FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -844,7 +844,7 @@ def select_with_select_privilege(self, user_name, grant_target_name, node=None): with Then("I attempt to select from view with privilege as the user"): output = node.query( - f"SELECT count(*) FROM {view_name}", settings=[("user", f"{user_name}")] + f"SELECT count(*) FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ).output assert output == "1", error() @@ -896,7 +896,7 @@ def select_with_revoked_select_privilege(self, user_name, grant_target_name, nod with Then("I attempt to select from view with privilege as the user"): node.query( - f"SELECT count(*) FROM {view_name}", + f"SELECT count(*) FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -930,7 +930,7 @@ def select_without_source_table_privilege(self, node=None): "I attempt to select from view without privilege on the source table" ): node.query( - f"SELECT count(*) FROM {view_name}", + f"SELECT count(*) FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -988,7 +988,7 @@ def select_with_source_table_privilege(self, user_name, grant_target_name, node= with Then("I check the user is able to select from the view"): output = node.query( - f"SELECT count(*) FROM {view_name}", + f"SELECT count(*) FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], ).output assert output == "0", error() @@ -1031,7 +1031,7 @@ def select_with_subquery(self, user_name, grant_target_name, node=None): table1_name = f"table1_{getuid()}" table2_name = f"table2_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view_name}" + select_view_query = "SELECT count(*) FROM {view_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1126,7 +1126,7 @@ def select_with_join_query(self, user_name, grant_target_name, node=None): table0_name = f"table0_{getuid()}" table1_name = f"table1_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view_name}" + select_view_query = "SELECT count(*) FROM {view_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1216,7 +1216,7 @@ def select_with_join_subquery(self, grant_target_name, user_name, node=None): table2_name = f"table2_{getuid()}" table3_name = f"table3_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view_name}" + select_view_query = "SELECT count(*) FROM {view_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1315,7 +1315,7 @@ def select_with_nested_views(self, grant_target_name, user_name, node=None): table1_name = f"table1_{getuid()}" table2_name = f"table2_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view2_name}" + select_view_query = "SELECT count(*) FROM {view2_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1451,7 +1451,7 @@ def drop_with_privilege(self, grant_target_name, user_name, node=None): node.query(f"DROP VIEW {view_name}", settings=[("user", f"{user_name}")]) with Then("I check the table does not exist"): - node.query(f"SELECT * FROM {view_name}", exitcode=exitcode, message=message) + node.query(f"SELECT * FROM {view_name} FORMAT TabSeparated", exitcode=exitcode, message=message) finally: with Finally("I drop the view"): diff --git a/rbac/tests/views/materialized_view.py b/rbac/tests/views/materialized_view.py index d6cf5f45e..73d47dea0 100755 --- a/rbac/tests/views/materialized_view.py +++ b/rbac/tests/views/materialized_view.py @@ -281,7 +281,7 @@ def create_with_source_table_privilege(self, user_name, grant_target_name, node= ) with Then("I check the view"): - output = node.query(f"SELECT count(*) FROM {view_name}").output + output = node.query(f"SELECT count(*) FROM {view_name} FORMAT TabSeparated").output assert output == "0", error() finally: @@ -1269,7 +1269,7 @@ def select_with_revoked_select_privilege(self, user_name, grant_target_name, nod with Then("I attempt to select from view with privilege as the user"): node.query( - f"SELECT count(*) FROM {view_name}", + f"SELECT count(*) FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -1305,7 +1305,7 @@ def select_without_source_table_privilege(self, node=None): "I attempt to select from view without privilege on the source table" ): node.query( - f"SELECT count(*) FROM {view_name}", + f"SELECT count(*) FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -1406,7 +1406,7 @@ def select_with_subquery(self, user_name, grant_target_name, node=None): table1_name = f"table1_{getuid()}" table2_name = f"table2_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view_name}" + select_view_query = "SELECT count(*) FROM {view_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1501,7 +1501,7 @@ def select_with_join_query(self, user_name, grant_target_name, node=None): table0_name = f"table0_{getuid()}" table1_name = f"table1_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view_name}" + select_view_query = "SELECT count(*) FROM {view_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1589,7 +1589,7 @@ def select_with_union_query(self, user_name, grant_target_name, node=None): table0_name = f"table0_{getuid()}" table1_name = f"table1_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view_name}" + select_view_query = "SELECT count(*) FROM {view_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1682,7 +1682,7 @@ def select_with_join_union_subquery(self, grant_target_name, user_name, node=Non table3_name = f"table3_{getuid()}" table4_name = f"table4_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view_name}" + select_view_query = "SELECT count(*) FROM {view_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1787,7 +1787,7 @@ def select_with_nested_views(self, grant_target_name, user_name, node=None): table2_name = f"table2_{getuid()}" table3_name = f"table3_{getuid()}" exitcode, message = errors.not_enough_privileges(name=f"{user_name}") - select_view_query = "SELECT count(*) FROM {view3_name}" + select_view_query = "SELECT count(*) FROM {view3_name} FORMAT TabSeparated" if node is None: node = self.context.node @@ -1916,7 +1916,7 @@ def select_without_target_table_privilege( node.query(f"GRANT SELECT ON {view_name} TO {grant_target_name}") with Then("I attempt to select from a view as the user"): node.query( - f"SELECT * FROM {view_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {view_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -1985,7 +1985,7 @@ def select_from_implicit_target_table(self, grant_target_name, user_name, node=N with Then("I attempt to SELECT from the implicit target table as the user"): node.query( - f"SELECT * FROM {implicit_table_name}", + f"SELECT * FROM {implicit_table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -1995,7 +1995,7 @@ def select_from_implicit_target_table(self, grant_target_name, user_name, node=N node.query(f"GRANT SELECT ON {view_name} TO {grant_target_name}") with Then("I attempt to SELECT from the implicit target table as the user"): node.query( - f"SELECT * FROM {implicit_table_name}", + f"SELECT * FROM {implicit_table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -2005,7 +2005,7 @@ def select_from_implicit_target_table(self, grant_target_name, user_name, node=N node.query(f"GRANT SELECT ON {implicit_table_name} TO {grant_target_name}") with Then("I attempt to SELECT from the implicit target table as the user"): node.query( - f"SELECT * FROM {implicit_table_name}", + f"SELECT * FROM {implicit_table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], ) @@ -2059,7 +2059,7 @@ def select_from_explicit_target_table(self, grant_target_name, user_name, node=N with Then("I attempt to SELECT from the explicit target table as the user"): node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -2069,7 +2069,7 @@ def select_from_explicit_target_table(self, grant_target_name, user_name, node=N node.query(f"GRANT SELECT ON {view_name} TO {grant_target_name}") with Then("I attempt to SELECT from the explicit target table as the user"): node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -2079,7 +2079,7 @@ def select_from_explicit_target_table(self, grant_target_name, user_name, node=N node.query(f"GRANT SELECT ON {table_name} TO {grant_target_name}") with Then("I attempt to SELECT from the explicit target table as the user"): node.query( - f"SELECT * FROM {table_name}", settings=[("user", f"{user_name}")] + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")] ) finally: @@ -2130,7 +2130,7 @@ def select_from_source_table(self, grant_target_name, user_name, node=None): with Then("I attempt to SELECT from the source table as the user"): node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -2140,7 +2140,7 @@ def select_from_source_table(self, grant_target_name, user_name, node=None): node.query(f"GRANT SELECT ON {view_name} TO {grant_target_name}") with Then("I attempt to SELECT from the implicit target table as the user"): node.query( - f"SELECT * FROM {table_name}", + f"SELECT * FROM {table_name} FORMAT TabSeparated", settings=[("user", f"{user_name}")], exitcode=exitcode, message=message, @@ -2217,7 +2217,7 @@ def drop_with_privilege(self, grant_target_name, user_name, node=None): node.query(f"DROP VIEW {view_name}", settings=[("user", f"{user_name}")]) with Then("I check the table does not exist"): - node.query(f"SELECT * FROM {view_name}", exitcode=exitcode, message=message) + node.query(f"SELECT * FROM {view_name} FORMAT TabSeparated", exitcode=exitcode, message=message) finally: with Finally("I drop the view"):