Skip python3 package installation on CentOS servers

Change-Id: If0f510c58013dd2e8c2f964ae041df1238c0ea25
This commit is contained in:
Federico Ressi 2020-11-23 11:21:03 +01:00
parent 832814174d
commit 4179cebd0c
2 changed files with 1 additions and 30 deletions

View File

@ -16,7 +16,6 @@ from __future__ import absolute_import
import tobiko import tobiko
from tobiko import config from tobiko import config
from tobiko.openstack import glance from tobiko.openstack import glance
from tobiko.openstack import nova
from tobiko.openstack.stacks import _nova from tobiko.openstack.stacks import _nova
@ -50,10 +49,3 @@ class CentosServerStackFixture(_nova.ServerStackFixture):
#: Flavor used to create a Nova server instance #: Flavor used to create a Nova server instance
flavor_stack = tobiko.required_setup_fixture(CentosFlavorStackFixture) 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,13 +15,9 @@
# under the License. # under the License.
from __future__ import absolute_import from __future__ import absolute_import
import six
import yaml
import tobiko import tobiko
from tobiko.shell import sh from tobiko.shell import sh
from tobiko.openstack import keystone from tobiko.openstack import keystone
from tobiko.openstack import nova
from tobiko.openstack import stacks from tobiko.openstack import stacks
from tobiko.tests.functional.openstack.stacks import test_cirros from tobiko.tests.functional.openstack.stacks import test_cirros
@ -33,26 +29,9 @@ class CentosServerStackTest(test_cirros.CirrosServerStackTest):
#: Stack of resources with a server attached to a floating IP #: Stack of resources with a server attached to a floating IP
stack = tobiko.required_setup_fixture(stacks.CentosServerStackFixture) stack = tobiko.required_setup_fixture(stacks.CentosServerStackFixture)
def test_cloud_config(self): def test_platform_python(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_platform_python3(self):
python_version = sh.execute(['/usr/libexec/platform-python', python_version = sh.execute(['/usr/libexec/platform-python',
'--version'], '--version'],
ssh_client=self.stack.ssh_client).stdout ssh_client=self.stack.ssh_client).stdout
self.assertTrue(python_version.startswith('Python 3.'), self.assertTrue(python_version.startswith('Python 3.'),
python_version) python_version)
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)