Merge pull request #1139 from freyes/swift-proxy-race-master

swift-proxy: wait for model to settle after running action
This commit is contained in:
Alex Kavanagh
2023-09-28 13:16:40 +01:00
committed by GitHub
2 changed files with 11 additions and 0 deletions

View File

@@ -125,6 +125,13 @@ class SwiftProxyTests(test_utils.OpenStackBaseTest):
'search-value': self.TEST_SEARCH_TARGET,
'weight': self.TEST_WEIGHT_INITIAL})
self.assertEqual(action.status, "completed")
# let everything settle, because after the set-weight action the
# swift-storage units need to get run swift-storage-relation-changed to
# get the new ring
logging.info("Waiting for model to settle.")
zaza.model.wait_for_agent_status()
zaza.model.block_until_all_units_idle()
self.assertTrue(
swift_utils.is_ring_synced('swift-proxy', 'object',
self.TEST_EXPECTED_RING_HOSTS))

View File

@@ -366,4 +366,8 @@ def is_ring_synced(proxy_app, ring, expected_hosts, model_name=None):
result = zaza.model.run_on_leader(proxy_app, cmd, model_name=model_name)
expected = ('{num}/{num} hosts matched, 0 error[s] while checking hosts.'
''.format(num=expected_hosts))
logging.info('Cmd: %s', str(cmd))
logging.info('Stdout: %s', result['Stdout'])
logging.info('Stderr: %s', result.get('Stderr', ''))
logging.info('Expected: %s', expected)
return bool(result['Stdout'].strip('\n') == expected)