From a66d9e9da1b1d57b130341faeb45248869d89984 Mon Sep 17 00:00:00 2001 From: suetin Date: Wed, 20 Mar 2024 00:40:00 +0300 Subject: [PATCH 1/6] check regex test --- tests/features/maintenance.feature | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/features/maintenance.feature b/tests/features/maintenance.feature index 3f0b6059..5310ec86 100644 --- a/tests/features/maintenance.feature +++ b/tests/features/maintenance.feature @@ -69,7 +69,8 @@ Feature: maintenance mode Then SQL result should match regexp """ [{ - "MasterEnabled":"0", + "aaaa":"0", + "bbbb":"1", "SlaveEnabled":"1" }] """ From 493bd7654523de38cc771fae538a4d5e23c6fb9f Mon Sep 17 00:00:00 2001 From: suetin Date: Thu, 25 Apr 2024 22:47:33 +0300 Subject: [PATCH 2/6] test regex --- tests/features/maintenance.feature | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/features/maintenance.feature b/tests/features/maintenance.feature index 5310ec86..238bf576 100644 --- a/tests/features/maintenance.feature +++ b/tests/features/maintenance.feature @@ -68,11 +68,7 @@ Feature: maintenance mode """ Then SQL result should match regexp """ - [{ - "aaaa":"0", - "bbbb":"1", - "SlaveEnabled":"1" - }] + "aaaa":"0" """ When I run SQL on mysql host "mysql1" """ From 5c399c8a0812c78906521949956ca87d8269bc85 Mon Sep 17 00:00:00 2001 From: suetin Date: Fri, 26 Apr 2024 01:53:18 +0300 Subject: [PATCH 3/6] fix maintenance.feature tests --- tests/features/maintenance.feature | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/features/maintenance.feature b/tests/features/maintenance.feature index 238bf576..19d5b0ec 100644 --- a/tests/features/maintenance.feature +++ b/tests/features/maintenance.feature @@ -66,15 +66,18 @@ Feature: maintenance mode """ SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; """ - Then SQL result should match regexp + Then SQL result should match json """ - "aaaa":"0" + [{ + "MasterEnabled":"0", + "SlaveEnabled":"1" + }] """ When I run SQL on mysql host "mysql1" """ SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; """ - Then SQL result should match regexp + Then SQL result should match json """ [{ "MasterEnabled":"1", @@ -102,7 +105,7 @@ Feature: maintenance mode """ SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; """ - Then SQL result should match regexp + Then SQL result should match json """ [{ "MasterEnabled":"0", @@ -113,7 +116,7 @@ Feature: maintenance mode """ SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; """ - Then SQL result should match regexp + Then SQL result should match json """ [{ "MasterEnabled":"0", @@ -134,7 +137,7 @@ Feature: maintenance mode """ SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; """ - Then SQL result should match regexp + Then SQL result should match json """ [{ "MasterEnabled":"0", @@ -145,7 +148,7 @@ Feature: maintenance mode """ SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; """ - Then SQL result should match regexp + Then SQL result should match json """ [{ "MasterEnabled":"1", From 0ae7aa42c1015266f2ec6b3bbc954b76dfbf26d4 Mon Sep 17 00:00:00 2001 From: suetin Date: Mon, 6 May 2024 21:03:54 +0300 Subject: [PATCH 4/6] fix maintenance.feature tests --- tests/features/maintenance.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/features/maintenance.feature b/tests/features/maintenance.feature index 19d5b0ec..4d17dcc2 100644 --- a/tests/features/maintenance.feature +++ b/tests/features/maintenance.feature @@ -75,7 +75,7 @@ Feature: maintenance mode """ When I run SQL on mysql host "mysql1" """ - SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; + show global variables like 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ From 5b0ff265629202c0472eaea74157b0251087fb11 Mon Sep 17 00:00:00 2001 From: suetin Date: Mon, 6 May 2024 21:18:50 +0300 Subject: [PATCH 5/6] fix maintenance.feature tests --- tests/features/maintenance.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/features/maintenance.feature b/tests/features/maintenance.feature index 4d17dcc2..2a59d6f0 100644 --- a/tests/features/maintenance.feature +++ b/tests/features/maintenance.feature @@ -64,7 +64,7 @@ Feature: maintenance mode """ When I run SQL on mysql host "mysql2" """ - SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; + show global variables like 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ From 9285a7ee1e2aecb5f371ca9dcaf996527bac423a Mon Sep 17 00:00:00 2001 From: suetin Date: Mon, 6 May 2024 22:30:07 +0300 Subject: [PATCH 6/6] fix maintenance.feature tests --- tests/features/maintenance.feature | 96 ++++++++++++++++++++---------- 1 file changed, 66 insertions(+), 30 deletions(-) diff --git a/tests/features/maintenance.feature b/tests/features/maintenance.feature index 2a59d6f0..1d49427a 100644 --- a/tests/features/maintenance.feature +++ b/tests/features/maintenance.feature @@ -64,25 +64,37 @@ Feature: maintenance mode """ When I run SQL on mysql host "mysql2" """ - show global variables like 'rpl_semi_sync_%_enabled' + SHOW GLOBAL VARIABLES LIKE 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ - [{ - "MasterEnabled":"0", - "SlaveEnabled":"1" - }] + [ + { + "Value":"OFF", + "Variable_name":"rpl_semi_sync_master_enabled" + }, + { + "Value":"ON", + "Variable_name":"rpl_semi_sync_slave_enabled" + } + ] """ When I run SQL on mysql host "mysql1" """ - show global variables like 'rpl_semi_sync_%_enabled' + SHOW GLOBAL VARIABLES LIKE 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ - [{ - "MasterEnabled":"1", - "SlaveEnabled":"0" - }] + [ + { + "Value":"ON", + "Variable_name":"rpl_semi_sync_master_enabled" + }, + { + "Value":"OFF", + "Variable_name":"rpl_semi_sync_slave_enabled" + } + ] """ When I run command on host "mysql1" """ @@ -103,25 +115,37 @@ Feature: maintenance mode And zookeeper node "/test/active_nodes" should not exist When I run SQL on mysql host "mysql2" """ - SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; + SHOW GLOBAL VARIABLES LIKE 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ - [{ - "MasterEnabled":"0", - "SlaveEnabled":"1" - }] + [ + { + "Value":"OFF", + "Variable_name":"rpl_semi_sync_master_enabled" + }, + { + "Value":"ON", + "Variable_name":"rpl_semi_sync_slave_enabled" + } + ] """ When I run SQL on mysql host "mysql1" """ - SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; + SHOW GLOBAL VARIABLES LIKE 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ - [{ - "MasterEnabled":"0", - "SlaveEnabled":"0" - }] + [ + { + "Value":"OFF", + "Variable_name":"rpl_semi_sync_master_enabled" + }, + { + "Value":"OFF", + "Variable_name":"rpl_semi_sync_slave_enabled" + } + ] """ When I run command on host "mysql1" """ @@ -135,25 +159,37 @@ Feature: maintenance mode """ When I run SQL on mysql host "mysql2" """ - SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; + SHOW GLOBAL VARIABLES LIKE 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ - [{ - "MasterEnabled":"0", - "SlaveEnabled":"1" - }] + [ + { + "Value":"OFF", + "Variable_name":"rpl_semi_sync_master_enabled" + }, + { + "Value":"ON", + "Variable_name":"rpl_semi_sync_slave_enabled" + } + ] """ When I run SQL on mysql host "mysql1" """ - SELECT @@rpl_semi_sync_master_enabled AS MasterEnabled, @@rpl_semi_sync_slave_enabled AS SlaveEnabled; + SHOW GLOBAL VARIABLES LIKE 'rpl_semi_sync_%_enabled' """ Then SQL result should match json """ - [{ - "MasterEnabled":"1", - "SlaveEnabled":"0" - }] + [ + { + "Value":"ON", + "Variable_name":"rpl_semi_sync_master_enabled" + }, + { + "Value":"OFF", + "Variable_name":"rpl_semi_sync_slave_enabled" + } + ] """ Scenario: master host in DCS updated correctly after manual master change