Minor change in HA test
As replica server seems to sync faster than primary due to diff in sync intervals, changed the code to check for replica first instead of waiting for primary to sync. Change-Id: If8ab4e7c42fea01d77afe47359743f70e94c9f58
This commit is contained in:
parent
e88a87559f
commit
602a157214
|
@ -215,30 +215,19 @@ class TestHA(manager_congress.ScenarioPolicyBase):
|
|||
self.start_replica(CONF.congressha.replica_port)
|
||||
replica_client = self.create_client(CONF.congressha.replica_type)
|
||||
|
||||
# Verify that primary server synced fake dataservice and policy
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_exists(
|
||||
self.client, 'datasource'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"primary doesn't have fake dataservice, data sync failed")
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_exists(
|
||||
self.client, 'policy'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"primary doesn't have fake policy, policy sync failed")
|
||||
|
||||
# Check replica server status
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_replica_server_status(
|
||||
replica_client),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException("Replica Server not ready")
|
||||
|
||||
# Relica server is up
|
||||
replica_server = True
|
||||
|
||||
# primary server might sync later than replica server due to
|
||||
# diff in datasource sync interval(P-30, replica-5). So checking
|
||||
# replica first
|
||||
|
||||
# Verify that replica server synced fake dataservice and policy
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_exists(
|
||||
|
@ -253,10 +242,40 @@ class TestHA(manager_congress.ScenarioPolicyBase):
|
|||
raise exceptions.TimeoutException(
|
||||
"replica doesn't have fake policy, policy sync failed")
|
||||
|
||||
# Verify that primary server synced fake dataservice and policy
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_exists(
|
||||
self.client, 'datasource'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"primary doesn't have fake dataservice, data sync failed")
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_exists(
|
||||
self.client, 'policy'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"primary doesn't have fake policy, policy sync failed")
|
||||
|
||||
# Remove fake from primary server instance.
|
||||
LOG.debug("removing fake datasource %s", str(fake_id))
|
||||
self.client.delete_datasource(fake_id)
|
||||
|
||||
# Verify that replica server has no fake datasource and fake policy
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_missing(
|
||||
replica_client, 'datasource'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"replica still has fake dataservice, sync failed")
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_missing(
|
||||
replica_client, 'policy'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"replica still fake policy, policy synchronizer failed")
|
||||
|
||||
LOG.debug("removed fake datasource from replica instance")
|
||||
|
||||
# Verify that primary server has no fake datasource and fake policy
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_missing(
|
||||
|
@ -273,20 +292,6 @@ class TestHA(manager_congress.ScenarioPolicyBase):
|
|||
|
||||
LOG.debug("removed fake datasource from primary instance")
|
||||
|
||||
# Verify that replica server has no fake datasource and fake policy
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_missing(
|
||||
replica_client, 'datasource'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"replica still has fake dataservice, sync failed")
|
||||
if not test.call_until_true(
|
||||
func=lambda: self._check_resource_missing(
|
||||
replica_client, 'policy'),
|
||||
duration=60, sleep_for=1):
|
||||
raise exceptions.TimeoutException(
|
||||
"replica still fake policy, policy synchronizer failed")
|
||||
|
||||
finally:
|
||||
if replica_server:
|
||||
self.stop_replica(CONF.congressha.replica_port)
|
||||
|
|
Loading…
Reference in New Issue