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

Add glance-simplestreams-sync --set-latest-property functest #853

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions zaza/openstack/charm_tests/glance_simplestreams_sync/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import pprint

import zaza.model as zaza_model
import zaza.charm_lifecycle.utils as lifecycle_utils
import zaza.openstack.utilities.generic as generic_utils
import zaza.openstack.utilities.openstack as openstack_utils

Expand Down Expand Up @@ -77,3 +78,17 @@ def sync_images():
logging.info('Contents of Keystone service catalog: "{}"'
.format(pprint.pformat(catalog)))
raise


def set_latest_property_config():
guimaluf marked this conversation as resolved.
Show resolved Hide resolved
"""Enable set_latest_property config.

This config adds `latest=true` to new synced images.
"""
logging.info("Change config `set_latest_property=true`")
zaza_model.set_application_config('glance-simplestreams-sync',
{'set_latest_property': 'true',
'snap-channel': 'edge'})
test_config = lifecycle_utils.get_charm_config(fatal=False)
zaza_model.wait_for_application_states(
states=test_config.get('target_deploy_status', {}))
20 changes: 20 additions & 0 deletions zaza/openstack/charm_tests/glance_simplestreams_sync/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,23 @@ def _check_local_product_streams(expected_images):
_check_local_product_streams(expected_images)

logging.debug("Local product stream successful")


class GlanceSimpleStreamsSyncWithPropertiesTest(GlanceSimpleStreamsSyncTest):
"""Glance Simple Streams Sync Test with Image property.

`setup.py:set_latest_property_config()` is required by this test and it is
called during charm-glance-simplestreams-sync/tests/tests.yaml:configure
phase.
"""

# TODO(guimalufb) test if the latest property gets removed from old images
def test_200_check_image_latest_property(self):
"""Verify that images had metadata property set."""
logging.debug("Checking images with latest=true property...")

filter_properties = {'filters': {'latest': 'true'}}
images = self.glance_client.images.list(**filter_properties)
self.assertTrue(len(list(images)) > 0,
"'latest=true' property not found in glance images"
" list")