Skip to content

Commit a512db0

Browse files
Testing host
1 parent 2df0e79 commit a512db0

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

docker-image-tests/percona-mysql-router/tests/test_router_static.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ def add_slave():
9292
'cluster', 'add-instance', '--uri=inno@mysql4', '--recoveryMethod=incremental'
9393
])
9494

95-
def router_bootstrap():
96-
subprocess.run([
95+
@pytest.fixture(scope='module')
96+
def inspect_data():
97+
dockerid = subprocess.check_output([
9798
'docker', 'run', '-d',
9899
'--name', 'mysql-router',
99100
'--net=innodbnet',
@@ -103,7 +104,11 @@ def router_bootstrap():
103104
'-e', 'MYSQL_PASSWORD=inno',
104105
'-e', 'MYSQL_INNODB_CLUSTER_MEMBERS=4',
105106
router_docker_image
106-
])
107+
]).decode().strip()
108+
inspect_data = json.loads(subprocess.check_output(['docker','inspect','mysql-router']))
109+
yield inspect_data[0]
110+
subprocess.check_call(['docker', 'rm', '-f', docker_id])
111+
107112

108113
create_network()
109114
create_mysql_config()
@@ -113,16 +118,7 @@ def router_bootstrap():
113118
docker_restart()
114119
create_cluster()
115120
add_slave()
116-
router_bootstrap()
117-
118-
def get_docker_id(container_name_mysql_router):
119-
try:
120-
command = f'docker ps --filter "name={container_name_mysql_router}" --format "{{.ID}}"'
121-
docker_id = subprocess.check_output(command, shell=True).decode().strip()
122-
return docker_id
123-
except subprocess.CalledProcessError as e:
124-
print(f"Error: {e}")
125-
return None
121+
host()
126122

127123
class TestRouterEnvironment:
128124
def test_mysqlrouter_version(self, host):

0 commit comments

Comments
 (0)