forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Centralize MySQL Flavor handling in tests.
- Loading branch information
Showing
3 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/python | ||
|
||
import environment | ||
|
||
|
||
class MysqlFlavor(object): | ||
"""Base class with default SQL statements""" | ||
|
||
def promote_slave_commands(self): | ||
"""Returns commands to convert a slave to a master.""" | ||
return [ | ||
"RESET MASTER", | ||
"STOP SLAVE", | ||
"RESET SLAVE", | ||
"CHANGE MASTER TO MASTER_HOST = ''", | ||
] | ||
|
||
def reset_replication_commands(self): | ||
return [ | ||
"RESET MASTER", | ||
"STOP SLAVE", | ||
"RESET SLAVE", | ||
'CHANGE MASTER TO MASTER_HOST = ""', | ||
] | ||
|
||
|
||
class GoogleMysql(MysqlFlavor): | ||
"""Overrides specific to Google MySQL""" | ||
|
||
|
||
class MariaDB(MysqlFlavor): | ||
"""Overrides specific to MariaDB""" | ||
|
||
def promote_slave_commands(self): | ||
return [ | ||
"RESET MASTER", | ||
"STOP SLAVE", | ||
"RESET SLAVE", | ||
] | ||
|
||
def reset_replication_commands(self): | ||
return [ | ||
"RESET MASTER", | ||
"STOP SLAVE", | ||
"RESET SLAVE", | ||
] | ||
|
||
if environment.mysql_flavor == "MariaDB": | ||
mysql_flavor = MariaDB() | ||
else: | ||
mysql_flavor = GoogleMysql() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters