Switch test_snapshot_pattern to full image
Use full based ubuntu image for tests with snapshot. Cirros has issues
in self written cloudinit which cleanup authorized_keys on second run
after server is build from snapshot and uuid is changed.
Add the following options
* image_full_ref
* image_full_username
* image_full_flavor
Related-Prod: PRODX-27524
Change-Id: I632829ad1bbed8f0c666b2f1488e078f262dfb7c
diff --git a/tempest/config.py b/tempest/config.py
index 3045759..52c68e9 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -303,6 +303,15 @@
help="Valid secondary image reference to be used in tests. "
"This is a required option, but if only one image is "
"available duplicate the value of image_ref above"),
+ cfg.StrOpt('image_full_ref',
+ help="This is image with full OS like ubuntu/centos used"
+ "in some tests. When not set related tests will be "
+ "skipped"),
+ cfg.StrOpt('image_full_username',
+ default="ubuntu",
+ help="Username for image_full_ref authentication."),
+ cfg.StrOpt('image_full_flavor_ref',
+ help="Flavor to boot image_full_ref."),
cfg.StrOpt('certified_image_ref',
help="Valid image reference to be used in image certificate "
"validation tests when enabled. This image must also "
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index d04cb9a..db8f533 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -41,6 +41,11 @@
super(TestSnapshotPattern, cls).skip_checks()
if not CONF.compute_feature_enabled.snapshot:
raise cls.skipException("Snapshotting is not available.")
+ if not all([CONF.compute.image_full_ref,
+ CONF.compute.image_full_username,
+ CONF.compute.image_full_flavor_ref]):
+ raise cls.skipException(
+ "Test requires image_full_* options to be set.")
@decorators.idempotent_id('608e604b-1d63-4a82-8e3e-91bc665c90b4')
@decorators.attr(type='slow')
@@ -51,16 +56,20 @@
# prepare for booting an instance
keypair = self.create_keypair()
security_group = self.create_security_group()
+ username = CONF.compute.image_full_username
# boot an instance and create a timestamp file in it
server = self.create_server(
key_name=keypair['name'],
- security_groups=[{'name': security_group['name']}])
+ security_groups=[{'name': security_group['name']}],
+ flavor=CONF.compute.image_full_flavor_ref,
+ image_id=CONF.compute.image_full_ref)
instance_ip = self.get_server_ip(server)
timestamp = self.create_timestamp(instance_ip,
private_key=keypair['private_key'],
- server=server)
+ server=server,
+ username=username)
# snapshot the instance
snapshot_image = self.create_server_snapshot(server=server)
@@ -74,13 +83,15 @@
server_from_snapshot = self.create_server(
image_id=snapshot_image['id'],
key_name=keypair['name'],
- security_groups=[{'name': security_group['name']}])
+ security_groups=[{'name': security_group['name']}],
+ flavor=CONF.compute.image_full_flavor_ref)
# check the existence of the timestamp file in the second instance
server_from_snapshot_ip = self.get_server_ip(server_from_snapshot)
timestamp2 = self.get_timestamp(server_from_snapshot_ip,
private_key=keypair['private_key'],
- server=server_from_snapshot)
+ server=server_from_snapshot,
+ username=username)
self.assertEqual(timestamp, timestamp2)
# snapshot the instance again