Add fix for mysql and add a retry
The mysql test only worked on the first controller, because the mysql container has different names (with a different suffix) on different controllers. Added logic to get the right controller name. Also added retry logic to the test on whether a node was an ipa client. Sometimes, this would query the client before it had been fully enrolled, causing the test to fail. Change-Id: Ibe52985f9ee15e1e30543f2d394fde141b06dc53
This commit is contained in:
parent
f782a512fe
commit
80dd51a794
|
@ -48,8 +48,12 @@ NovajoinGroup = [
|
|||
cfg.StrOpt('tripleo_undercloud',
|
||||
default='undercloud',
|
||||
help='Undercloud short host name'),
|
||||
cfg.StrOpt('mysql_command',
|
||||
default=("sudo podman exec galera-bundle-podman-0"
|
||||
" /usr/bin/mysql"),
|
||||
help='mysql client executable')
|
||||
cfg.StrOpt('container_cli_exec',
|
||||
default="sudo podman exec ",
|
||||
help='container exec command'),
|
||||
cfg.StrOpt('mysql_container_find_command',
|
||||
default=("sudo podman ls |"
|
||||
"grep galera-bundle-podman|"
|
||||
"awk '{print \$NF}'"),
|
||||
help='mysql container find command')
|
||||
]
|
||||
|
|
|
@ -136,13 +136,18 @@ class NovajoinScenarioTest(manager.ScenarioTest):
|
|||
service=service, hostname=host, realm=self.ipa_client.realm
|
||||
)
|
||||
|
||||
@retry_with_timeout
|
||||
def verify_host_is_ipaclient(self, hostip, user, keypair):
|
||||
cmd = "id admin"
|
||||
private_key = keypair['private_key']
|
||||
ssh_client = self.get_remote_client(hostip, user, private_key)
|
||||
result = ssh_client.exec_command(cmd)
|
||||
params = ['uid', 'gid', 'groups']
|
||||
self.assertTrue(all(x in result for x in params))
|
||||
try:
|
||||
cmd = "id admin"
|
||||
private_key = keypair['private_key']
|
||||
ssh_client = self.get_remote_client(hostip, user, private_key)
|
||||
result = ssh_client.exec_command(cmd)
|
||||
params = ['uid', 'gid', 'groups']
|
||||
return (all(x in result for x in params))
|
||||
except Exception as e:
|
||||
LOG.error(str(e))
|
||||
return False
|
||||
|
||||
def verify_overcloud_host_is_ipaclient(self, hostip, user):
|
||||
cmd = 'id admin'
|
||||
|
@ -300,7 +305,13 @@ class NovajoinScenarioTest(manager.ScenarioTest):
|
|||
return self.execute_on_controller(user, host_ip, cmd).rstrip()
|
||||
|
||||
def verify_mysql_tls_connection(self, user, host_ip):
|
||||
cmd = (CONF.novajoin.mysql_command +
|
||||
mysql_container = self.execute_on_controller(
|
||||
user,
|
||||
host_ip,
|
||||
CONF.novajoin.mysql_container_find_command).rstrip()
|
||||
cmd = (CONF.novajoin.container_cli_exec + " " +
|
||||
mysql_container +
|
||||
" /usr/bin/mysql" +
|
||||
" --ssl -e \"SHOW SESSION STATUS LIKE 'Ssl_version';\"")
|
||||
result = self.execute_on_controller(user, host_ip, cmd)
|
||||
self.assertTrue('TLS' in result)
|
||||
|
@ -311,8 +322,14 @@ class NovajoinScenarioTest(manager.ScenarioTest):
|
|||
dbuser,
|
||||
dbhost,
|
||||
dbpassword):
|
||||
mysql_container = self.execute_on_controller(
|
||||
user,
|
||||
host_ip,
|
||||
CONF.novajoin.mysql_container_find_command).rstrip()
|
||||
sql = "SHOW SESSION STATUS LIKE \'Ssl_version\';"
|
||||
cmd = (CONF.novajoin.mysql_command +
|
||||
cmd = (CONF.novajoin.container_cli_exec + " " +
|
||||
mysql_container +
|
||||
" /usr/bin/mysql" +
|
||||
' --ssl -u {user} -h {host} --password={password} '
|
||||
'-e \"{sql}\"'.format(user=dbuser,
|
||||
host=dbhost,
|
||||
|
@ -327,7 +344,13 @@ class NovajoinScenarioTest(manager.ScenarioTest):
|
|||
dbuser,
|
||||
dbhost,
|
||||
dbpassword):
|
||||
cmd = (CONF.novajoin.mysql_command +
|
||||
mysql_container = self.execute_on_controller(
|
||||
user,
|
||||
host_ip,
|
||||
CONF.novajoin.mysql_container_find_command).rstrip()
|
||||
cmd = (CONF.novajoin.container_cli_exec + " " +
|
||||
mysql_container +
|
||||
" /usr/bin/mysql" +
|
||||
' -u {user} -h {host} --password={password} '
|
||||
'-e \"SHOW DATABASES;\"'.format(user=dbuser,
|
||||
host=dbhost,
|
||||
|
|
Loading…
Reference in New Issue