Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift-proxy: wait for model to settle after running action #1139

Merged
merged 2 commits into from Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions zaza/openstack/charm_tests/swift/tests.py
Expand Up @@ -125,6 +125,13 @@ def test_904_set_weight_action_and_validate_rebalance(self):
'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))
Expand Down
4 changes: 4 additions & 0 deletions zaza/openstack/utilities/swift.py
Expand Up @@ -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)