Fixed test flakkiness

This commit is contained in:
Vasily Nemkov 2021-03-11 14:43:05 +02:00
parent 2159fb8481
commit 03bff5c3b5
2 changed files with 77 additions and 78 deletions

View File

@ -8,85 +8,85 @@ GRANT queries
REVOKE queries
Misc queries
ACTUAL LOG CONTENT:
Select -- SET ROLE sqllt_role; -- tests are executed by user `default` which is defined in XML and is impossible to update.\n\nSELECT \'ALTER TABLE queries\';
Select -- SYSTEM RELOAD DICTIONARY sqllt.dictionary; -- temporary out of order: Code: 210, Connection refused (localhost:9001) (version 21.3.1.1)\n-- DROP REPLICA\n-- haha, no\n-- SYSTEM KILL;\n-- SYSTEM SHUTDOWN;\n\n-- Since we don\'t really care about the actual output, suppress it with `FORMAT Null`.\nSELECT \'SHOW queries\';
Select -- not done, seems to hard, so I\'ve skipped queries of ALTER-X, where X is:\n-- PARTITION\n-- ORDER BY\n-- SAMPLE BY\n-- INDEX\n-- CONSTRAINT\n-- TTL\n-- USER\n-- QUOTA\n-- ROLE\n-- ROW POLICY\n-- SETTINGS PROFILE\n\nSELECT \'SYSTEM queries\';
Alter ALTER TABLE table ADD COLUMN new_col UInt32 DEFAULT 123456789;
Alter ALTER TABLE table CLEAR COLUMN new_col;
Alter ALTER TABLE table COMMENT COLUMN new_col \'dummy column with a comment\';
Alter ALTER TABLE table DELETE WHERE i > 65535;
Alter ALTER TABLE table DROP COLUMN the_new_col;
Alter ALTER TABLE table MODIFY COLUMN new_col DateTime DEFAULT \'2015-05-18 07:40:13\';
Alter ALTER TABLE table MODIFY COLUMN new_col REMOVE COMMENT;
Alter ALTER TABLE table RENAME COLUMN new_col TO the_new_col;
Alter ALTER TABLE table UPDATE i = i + 1 WHERE 1;
Create ATTACH TABLE sqllt.table;
CHECK TABLE sqllt.table FORMAT Null;
Select SELECT \'DROP queries and also a cleanup before the test\';
Drop DROP DATABASE IF EXISTS sqllt SYNC;
DROP USER IF EXISTS sqllt_user;
DROP ROLE IF EXISTS sqllt_role;
DROP POLICY IF EXISTS sqllt_policy ON sqllt.table, sqllt.view, sqllt.dictionary;
DROP ROW POLICY IF EXISTS sqllt_row_policy ON sqllt.table, sqllt.view, sqllt.dictionary;
DROP QUOTA IF EXISTS sqllt_quota;
DROP SETTINGS PROFILE IF EXISTS sqllt_settings_profile;
Select SELECT \'CREATE queries\';
Create CREATE DATABASE sqllt;
Create CREATE TABLE sqllt.table\n(\n i UInt8, s String\n)\nENGINE = MergeTree PARTITION BY tuple() ORDER BY tuple();
Create CREATE VIEW sqllt.view AS SELECT i, s FROM sqllt.table;
Create CREATE DICTIONARY sqllt.dictionary (key UInt64, value UInt64) PRIMARY KEY key SOURCE(CLICKHOUSE(DB \'sqllt\' TABLE \'table\' HOST \'localhost\' PORT 9001)) LIFETIME(0) LAYOUT(FLAT());
CREATE USER sqllt_user IDENTIFIED WITH PLAINTEXT_PASSWORD BY \'password\';
CREATE ROLE sqllt_role;
CREATE POLICY sqllt_policy ON sqllt.table, sqllt.view, sqllt.dictionary AS PERMISSIVE TO ALL;
CREATE POLICY sqllt_row_policy ON sqllt.table, sqllt.view, sqllt.dictionary AS PERMISSIVE TO ALL;
CREATE QUOTA sqllt_quota KEYED BY user_name TO sqllt_role;
CREATE ROLE sqllt_role;
CREATE SETTINGS PROFILE sqllt_settings_profile SETTINGS interactive_delay = 200000;
Create CREATE TABLE sqllt.table\n(\n i UInt8, s String\n)\nENGINE = MergeTree PARTITION BY tuple() ORDER BY tuple();
CREATE USER sqllt_user IDENTIFIED WITH PLAINTEXT_PASSWORD BY \'password\';
Create CREATE VIEW sqllt.view AS SELECT i, s FROM sqllt.table;
DESCRIBE TABLE sqllt.table FORMAT Null;
Drop DETACH TABLE sqllt.table;
Drop DROP DATABASE IF EXISTS sqllt SYNC;
DROP POLICY IF EXISTS sqllt_policy ON sqllt.table, sqllt.view, sqllt.dictionary;
DROP QUOTA IF EXISTS sqllt_quota;
DROP ROLE IF EXISTS sqllt_role;
DROP ROW POLICY IF EXISTS sqllt_row_policy ON sqllt.table, sqllt.view, sqllt.dictionary;
DROP SETTINGS PROFILE IF EXISTS sqllt_settings_profile;
Drop DROP TABLE sqllt.table SYNC;
DROP USER IF EXISTS sqllt_user;
Grant GRANT DROP ON sqllt.view TO sqllt_user;
Grant GRANT SELECT ON sqllt.table TO sqllt_user;
Grant GRANT sqllt_role TO sqllt_user;
Rename RENAME TABLE sqllt.table TO sqllt.table_new;
Rename RENAME TABLE sqllt.table_new TO sqllt.table;
Revoke REVOKE DROP ON sqllt.view FROM sqllt_user;
Revoke REVOKE SELECT ON sqllt.table FROM sqllt_user;
Select SELECT \'CREATE queries\';
Select SELECT \'DROP queries and also a cleanup before the test\';
Select SELECT \'GRANT queries\';
Select SELECT \'Misc queries\';
Select SELECT \'REVOKE queries\';
Select SELECT \'SET queries\';
SET DEFAULT ROLE sqllt_role TO sqllt_user;
SET log_profile_events=false;
SHOW CREATE DICTIONARY sqllt.dictionary FORMAT Null;
SHOW CREATE POLICY sqllt_policy FORMAT Null;
SHOW CREATE QUOTA sqllt_quota FORMAT Null;
SHOW CREATE ROLE sqllt_role FORMAT Null;
SHOW CREATE ROW POLICY sqllt_row_policy FORMAT Null;
SHOW CREATE SETTINGS PROFILE sqllt_settings_profile FORMAT Null;
SHOW CREATE TABLE sqllt.table FORMAT Null;
SHOW CREATE USER sqllt_user FORMAT Null;
SHOW DATABASES LIKE \'sqllt\' FORMAT Null;
SHOW DICTIONARIES FROM sqllt FORMAT Null;
SHOW GRANTS FOR sqllt_user FORMAT Null;
SHOW GRANTS FORMAT Null;
SHOW TABLES FROM sqllt FORMAT Null;
SET DEFAULT ROLE sqllt_role TO sqllt_user;
Select -- SET ROLE sqllt_role; -- tests are executed by user `default` which is defined in XML and is impossible to update.\n\nSELECT \'ALTER TABLE queries\';
Alter ALTER TABLE sqllt.table ADD COLUMN new_col UInt32 DEFAULT 123456789;
Alter ALTER TABLE sqllt.table COMMENT COLUMN new_col \'dummy column with a comment\';
Alter ALTER TABLE sqllt.table CLEAR COLUMN new_col;
Alter ALTER TABLE sqllt.table MODIFY COLUMN new_col DateTime DEFAULT \'2015-05-18 07:40:13\';
Alter ALTER TABLE sqllt.table MODIFY COLUMN new_col REMOVE COMMENT;
Alter ALTER TABLE sqllt.table RENAME COLUMN new_col TO the_new_col;
Alter ALTER TABLE sqllt.table DROP COLUMN the_new_col;
Alter ALTER TABLE sqllt.table UPDATE i = i + 1 WHERE 1;
Alter ALTER TABLE sqllt.table DELETE WHERE i > 65535;
Select -- not done, seems to hard, so I\'ve skipped queries of ALTER-X, where X is:\n-- PARTITION\n-- ORDER BY\n-- SAMPLE BY\n-- INDEX\n-- CONSTRAINT\n-- TTL\n-- USER\n-- QUOTA\n-- ROLE\n-- ROW POLICY\n-- SETTINGS PROFILE\n\nSELECT \'SYSTEM queries\';
System SYSTEM RELOAD EMBEDDED DICTIONARIES;
System SYSTEM RELOAD DICTIONARIES;
System SYSTEM DROP DNS CACHE;
System SYSTEM DROP MARK CACHE;
System SYSTEM DROP UNCOMPRESSED CACHE;
System SYSTEM FLUSH LOGS;
System SYSTEM RELOAD CONFIG;
System SYSTEM RELOAD DICTIONARIES;
System SYSTEM RELOAD EMBEDDED DICTIONARIES;
System SYSTEM START FETCHES;
System SYSTEM START MERGES;
System SYSTEM START MOVES;
System SYSTEM START REPLICATED SENDS;
System SYSTEM START TTL MERGES;
System SYSTEM STOP FETCHES;
System SYSTEM STOP MERGES;
System SYSTEM STOP MOVES;
System SYSTEM STOP REPLICATED SENDS;
System SYSTEM START MERGES;
System SYSTEM STOP TTL MERGES;
System SYSTEM START TTL MERGES;
System SYSTEM STOP MOVES;
System SYSTEM START MOVES;
System SYSTEM STOP FETCHES;
System SYSTEM START FETCHES;
System SYSTEM STOP REPLICATED SENDS;
System SYSTEM START REPLICATED SENDS;
Select -- SYSTEM RELOAD DICTIONARY sqllt.dictionary; -- temporary out of order: Code: 210, Connection refused (localhost:9001) (version 21.3.1.1)\n-- DROP REPLICA\n-- haha, no\n-- SYSTEM KILL;\n-- SYSTEM SHUTDOWN;\n\n-- Since we don\'t really care about the actual output, suppress it with `FORMAT Null`.\nSELECT \'SHOW queries\';
SHOW CREATE TABLE sqllt.table FORMAT Null;
SHOW CREATE DICTIONARY sqllt.dictionary FORMAT Null;
SHOW DATABASES LIKE \'sqllt\' FORMAT Null;
SHOW TABLES FROM sqllt FORMAT Null;
SHOW DICTIONARIES FROM sqllt FORMAT Null;
SHOW GRANTS FORMAT Null;
SHOW GRANTS FOR sqllt_user FORMAT Null;
SHOW CREATE USER sqllt_user FORMAT Null;
SHOW CREATE ROLE sqllt_role FORMAT Null;
SHOW CREATE POLICY sqllt_policy FORMAT Null;
SHOW CREATE ROW POLICY sqllt_row_policy FORMAT Null;
SHOW CREATE QUOTA sqllt_quota FORMAT Null;
SHOW CREATE SETTINGS PROFILE sqllt_settings_profile FORMAT Null;
Select SELECT \'GRANT queries\';
Grant GRANT SELECT ON sqllt.table TO sqllt_user;
Grant GRANT DROP ON sqllt.view TO sqllt_user;
Select SELECT \'REVOKE queries\';
Revoke REVOKE SELECT ON sqllt.table FROM sqllt_user;
Revoke REVOKE DROP ON sqllt.view FROM sqllt_user;
Select SELECT \'Misc queries\';
DESCRIBE TABLE sqllt.table FORMAT Null;
CHECK TABLE sqllt.table FORMAT Null;
Drop DETACH TABLE sqllt.table;
Create ATTACH TABLE sqllt.table;
Rename RENAME TABLE sqllt.table TO sqllt.table_new;
Rename RENAME TABLE sqllt.table_new TO sqllt.table;
Drop TRUNCATE TABLE sqllt.table;
USE sqllt
Drop DROP TABLE sqllt.table SYNC;
SET log_comment=\'\';
DROP queries and also a cleanup after the test

View File

@ -12,7 +12,6 @@ DROP SETTINGS PROFILE IF EXISTS sqllt_settings_profile;
SELECT 'CREATE queries';
CREATE DATABASE sqllt;
USE sqllt;
CREATE TABLE sqllt.table
(
@ -41,15 +40,15 @@ SET DEFAULT ROLE sqllt_role TO sqllt_user;
-- SET ROLE sqllt_role; -- tests are executed by user `default` which is defined in XML and is impossible to update.
SELECT 'ALTER TABLE queries';
ALTER TABLE table ADD COLUMN new_col UInt32 DEFAULT 123456789;
ALTER TABLE table COMMENT COLUMN new_col 'dummy column with a comment';
ALTER TABLE table CLEAR COLUMN new_col;
ALTER TABLE table MODIFY COLUMN new_col DateTime DEFAULT '2015-05-18 07:40:13';
ALTER TABLE table MODIFY COLUMN new_col REMOVE COMMENT;
ALTER TABLE table RENAME COLUMN new_col TO the_new_col;
ALTER TABLE table DROP COLUMN the_new_col;
ALTER TABLE table UPDATE i = i + 1 WHERE 1;
ALTER TABLE table DELETE WHERE i > 65535;
ALTER TABLE sqllt.table ADD COLUMN new_col UInt32 DEFAULT 123456789;
ALTER TABLE sqllt.table COMMENT COLUMN new_col 'dummy column with a comment';
ALTER TABLE sqllt.table CLEAR COLUMN new_col;
ALTER TABLE sqllt.table MODIFY COLUMN new_col DateTime DEFAULT '2015-05-18 07:40:13';
ALTER TABLE sqllt.table MODIFY COLUMN new_col REMOVE COMMENT;
ALTER TABLE sqllt.table RENAME COLUMN new_col TO the_new_col;
ALTER TABLE sqllt.table DROP COLUMN the_new_col;
ALTER TABLE sqllt.table UPDATE i = i + 1 WHERE 1;
ALTER TABLE sqllt.table DELETE WHERE i > 65535;
-- not done, seems to hard, so I've skipped queries of ALTER-X, where X is:
-- PARTITION
@ -126,6 +125,7 @@ RENAME TABLE sqllt.table_new TO sqllt.table;
TRUNCATE TABLE sqllt.table;
DROP TABLE sqllt.table SYNC;
SET log_comment='';
---------------------------------------------------------------------------------------------------
-- Now get all logs related to this test
---------------------------------------------------------------------------------------------------
@ -136,10 +136,9 @@ SELECT 'ACTUAL LOG CONTENT:';
-- Try to filter out all possible previous junk events by excluding old log entries,
SELECT query_kind, query FROM system.query_log
WHERE
log_comment LIKE '%system.query_log%' AND type == 'QueryStart' AND query_start_time >= now() - 5
-- this one is to make stylecheck happy and to validate that CREATE\DROP queries of non-db-bound-objects, like USER\ROLS are logged properly.
AND (current_database == currentDatabase() OR current_database != currentDatabase())
ORDER BY query;
log_comment LIKE '%system.query_log%' AND type == 'QueryStart' AND event_time >= now() - 10
AND current_database == currentDatabase()
ORDER BY event_time_microseconds;
-- cleanup