Skip to content

Commit

Permalink
Remove copy-pasted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
noname0443 committed Sep 18, 2024
1 parent 08b4b7c commit a5fbdf6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 95 deletions.
45 changes: 7 additions & 38 deletions tests/features/switchover_from.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,46 +37,11 @@ Feature: manual switchover from old master
}
"""

Scenario: if switchover was approved, it will not be rejected
Given cluster is up and running
Then zookeeper node "/test/active_nodes" should match json_exactly within "20" seconds
"""
["mysql1","mysql2","mysql3"]
"""
When mysql on host "mysql3" is killed
And mysql on host "mysql2" is killed
And I set zookeeper node "/test/switch" to
"""
{
"from": "mysql1",
"to": "",
"cause": "manual",
"initiated_by": "mysql1",
"run_count": 1
}
"""
Then zookeeper node "/test/last_switch" should not exist within "30" seconds
Then zookeeper node "/test/last_rejected_switch" should not exist within "30" seconds
When mysql on host "mysql3" is started
And mysql on host "mysql2" is started
Then zookeeper node "/test/last_switch" should match json within "30" seconds
Scenario Outline: if switchover was approved, it will not be rejected
Given cluster environment is
"""
{
"from": "mysql1",
"to": "",
"cause": "manual",
"initiated_by": "mysql1",
"result": {
"ok": true
}
}
FORCE_SWITCHOVER=<force_switchover>
"""

Scenario: force switchover works from
Given cluster environment is
"""
FORCE_SWITCHOVER=true
"""
Given cluster is up and running
Then zookeeper node "/test/active_nodes" should match json_exactly within "20" seconds
"""
Expand Down Expand Up @@ -110,6 +75,10 @@ Feature: manual switchover from old master
}
}
"""
Examples:
| force_switchover |
| true |
| false |

Scenario Outline: switchover from works on healthy cluster
Given cluster environment is
Expand Down
64 changes: 7 additions & 57 deletions tests/features/switchover_to.feature
Original file line number Diff line number Diff line change
@@ -1,64 +1,10 @@
Feature: manual switchover to new master


Scenario: switchover on kill all running query on old master
Given cluster is up and running
Then mysql host "mysql1" should be master
And mysql host "mysql2" should be replica of "mysql1"
And mysql replication on host "mysql2" should run fine within "5" seconds
And mysql host "mysql3" should be replica of "mysql1"
And mysql replication on host "mysql3" should run fine within "5" seconds
And zookeeper node "/test/active_nodes" should match json_exactly within "30" seconds
"""
["mysql1","mysql2","mysql3"]
"""
When I run heavy user requests on host "mysql1" for "3600" seconds
When I run command on host "mysql1"
"""
mysync switch --to mysql2 --wait=0s
"""
Then command return code should be "0"
And command output should match regexp
"""
switchover scheduled
"""
And zookeeper node "/test/switch" should match json
"""
{
"from": "",
"to": "mysql2"
}
"""
Then zookeeper node "/test/last_switch" should match json within "120" seconds
"""
{
"from": "",
"to": "mysql2",
"result": {
"ok": true
}
}
"""
Then mysql host "mysql2" should be master
And mysql host "mysql2" should have variable "rpl_semi_sync_master_enabled" set to "1"
And mysql host "mysql2" should have variable "rpl_semi_sync_slave_enabled" set to "0"
And mysql host "mysql2" should be writable
And mysql host "mysql1" should be replica of "mysql2"
And mysql host "mysql1" should have variable "rpl_semi_sync_slave_enabled" set to "1"
And mysql host "mysql1" should have variable "rpl_semi_sync_master_enabled" set to "0"
And mysql replication on host "mysql1" should run fine within "3" seconds
And mysql host "mysql1" should be read only
And mysql host "mysql3" should be replica of "mysql2"
And mysql host "mysql3" should have variable "rpl_semi_sync_slave_enabled" set to "1"
And mysql host "mysql3" should have variable "rpl_semi_sync_master_enabled" set to "0"
And mysql replication on host "mysql3" should run fine within "3" seconds
And mysql host "mysql3" should be read only

Scenario: force switchover works to
Scenario Outline: switchover on kill all running query on old master
Given cluster environment is
"""
FORCE_SWITCHOVER=true
FORCE_SWITCHOVER=<force_switchover>
"""
Given cluster is up and running
Then mysql host "mysql1" should be master
Expand Down Expand Up @@ -96,6 +42,7 @@ Feature: manual switchover to new master
"ok": true
}
}
"""
Then mysql host "mysql2" should be master
And mysql host "mysql2" should have variable "rpl_semi_sync_master_enabled" set to "1"
Expand All @@ -111,7 +58,10 @@ Feature: manual switchover to new master
And mysql host "mysql3" should have variable "rpl_semi_sync_master_enabled" set to "0"
And mysql replication on host "mysql3" should run fine within "3" seconds
And mysql host "mysql3" should be read only

Examples:
| force_switchover |
| true |
| false |

Scenario Outline: switchover to works on healthy cluster
Given cluster environment is
Expand Down

0 comments on commit a5fbdf6

Please sign in to comment.