Switch from CentOS 7 image to version 8

Change-Id: I56ebdef36b09cc576404cf8efde160d79ae246f3
This commit is contained in:
Federico Ressi 2020-03-02 13:11:31 +01:00
parent 253efa1019
commit 1d90b2e3b3
2 changed files with 30 additions and 12 deletions

View File

@ -16,20 +16,16 @@ from __future__ import absolute_import
import tobiko
from tobiko import config
from tobiko.openstack import glance
from tobiko.openstack import nova
from tobiko.openstack.stacks import _nova
CONF = config.CONF
if glance.has_lzma():
CENTOS_IMAGE_URL = (
'http://cloud.centos.org/centos/7/images/'
'CentOS-7-x86_64-GenericCloud.qcow2.xz')
else:
CENTOS_IMAGE_URL = (
'http://cloud.centos.org/centos/7/images/'
'CentOS-7-x86_64-GenericCloud.qcow2c')
CENTOS_IMAGE_URL = (
'http://cloud.centos.org/centos/8/x86_64/images/'
'CentOS-8-GenericCloud-8.1.1911-20200113.3.x86_64.qcow2')
class CentosImageFixture(glance.URLGlanceImageFixture):
@ -53,3 +49,10 @@ class CentosServerStackFixture(_nova.ServerStackFixture):
#: Flavor used to create a Nova server instance
flavor_stack = tobiko.required_setup_fixture(CentosFlavorStackFixture)
#: Install Python3 package by default
@property
def cloud_config(self):
return nova.cloud_config(
super(CentosServerStackFixture, self).cloud_config,
packages=['python3'])

View File

@ -15,8 +15,12 @@
# under the License.
from __future__ import absolute_import
import six
import yaml
import tobiko
from tobiko.shell import sh
from tobiko.openstack import nova
from tobiko.openstack import stacks
from tobiko.tests.functional.openstack.stacks import test_cirros
@ -27,8 +31,19 @@ class CentosServerStackTest(test_cirros.CirrosServerStackTest):
#: Stack of resources with a server attached to a floating IP
stack = tobiko.required_setup_fixture(stacks.CentosServerStackFixture)
def test_python(self):
python_version = sh.execute(['python', '--version'],
ssh_client=self.stack.ssh_client).stderr
self.assertTrue(python_version.startswith('Python 2.7'),
def test_cloud_config(self):
cloud_config = self.stack.cloud_config
self.assertIn('python3', cloud_config['packages'])
def test_user_data(self):
user_data = self.stack.user_data
self.assertIsInstance(user_data, six.string_types)
self.assertTrue(user_data.startswith('#cloud-config\n'), user_data)
self.assertEqual(self.stack.cloud_config, yaml.load(user_data))
def test_python3(self):
nova.wait_for_cloud_init_done(ssh_client=self.stack.ssh_client)
python_version = sh.execute(['python3', '--version'],
ssh_client=self.stack.ssh_client).stdout
self.assertTrue(python_version.startswith('Python 3.'),
python_version)