Skip to content

Commit

Permalink
Testing host
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushikpuneet07 committed Oct 4, 2023
1 parent 2df0e79 commit 952d9da
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ def add_slave():
'cluster', 'add-instance', '--uri=inno@mysql4', '--recoveryMethod=incremental'
])

def router_bootstrap():
subprocess.run([
@pytest.fixture(scope='module')
def inspect_data():
dockerid = subprocess.check_output([
'docker', 'run', '-d',
'--name', 'mysql-router',
'--net=innodbnet',
Expand All @@ -103,7 +104,11 @@ def router_bootstrap():
'-e', 'MYSQL_PASSWORD=inno',
'-e', 'MYSQL_INNODB_CLUSTER_MEMBERS=4',
router_docker_image
])
]).decode().strip()
inspect_data = json.loads(subprocess.check_output(['docker','inspect','mysql-router']))
yield inspect_data[0]
subprocess.check_call(['docker', 'rm', '-f', docker_id])


create_network()
create_mysql_config()
Expand All @@ -113,16 +118,7 @@ def router_bootstrap():
docker_restart()
create_cluster()
add_slave()
router_bootstrap()

def get_docker_id(container_name_mysql_router):
try:
command = f'docker ps --filter "name={container_name_mysql_router}" --format "{{.ID}}"'
docker_id = subprocess.check_output(command, shell=True).decode().strip()
return docker_id
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
return None
inspect_data()

class TestRouterEnvironment:
def test_mysqlrouter_version(self, host):
Expand Down

0 comments on commit 952d9da

Please sign in to comment.