diff --git a/.zuul.yaml b/.zuul.yaml index 8abf5801..884d2b80 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -80,18 +80,26 @@ - job: name: sahara-tests-tempest-v2 description: | - Run Tempest tests from the Sahara plugin against Sahara APIv2. + Run Tempest tests from the Sahara plugin against Sahara APIv2 + and Python 3. parent: sahara-tests-tempest required-projects: - openstack/python-saharaclient branches: master vars: + devstack_localrc: + USE_PYTHON3: 'True' devstack_local_conf: test-config: $TEMPEST_CONFIG: data-processing: api_version_saharaclient: '2' use_api_v2: 'True' + devstack_services: + s-account: false + s-container: false + s-object: false + s-proxy: false # variant for pre-Rocky branches (no S3) - job: diff --git a/sahara_tempest_plugin/tests/cli/base.py b/sahara_tempest_plugin/tests/cli/base.py index 2aac58f4..1a64e155 100644 --- a/sahara_tempest_plugin/tests/cli/base.py +++ b/sahara_tempest_plugin/tests/cli/base.py @@ -188,18 +188,15 @@ class ClientTestBase(base.ClientTestBase): except exc.CommandFailed as e: # lower() is required because "result" string could # have the first letter capitalized. - output_msg = str(e).splitlines() - for msg in output_msg: - if msg.lower() == error_message.lower(): - self.assertEqual(error_message.lower(), msg.lower()) - msg_exist = True + if error_message.lower() in str(e).lower(): + msg_exist = True if not msg_exist: - raise exc.TempestException('%s is not a part of output of ' - 'executed command %s' - % (error_message, cmd)) + raise exc.TempestException('"%s" is not a part of output of ' + 'executed command "%s" (%s)' + % (error_message, cmd, output_msg)) else: - raise exc.TempestException('%s %s in negative scenarios have been ' - 'executed without any errors' + raise exc.TempestException('"%s %s" in negative scenarios has ' + 'been executed without any errors' % (cmd, name)) @classmethod diff --git a/sahara_tempest_plugin/tests/cli/job_binaries.py b/sahara_tempest_plugin/tests/cli/job_binaries.py index 0c65e09f..c86989e8 100644 --- a/sahara_tempest_plugin/tests/cli/job_binaries.py +++ b/sahara_tempest_plugin/tests/cli/job_binaries.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +from filecmp import cmp from os import fdopen from os import path from os import remove @@ -31,6 +32,7 @@ class SaharaJobBinaryCLITest(base.ClientTestBase): def openstack_job_binary_create(self, job_internal=True): job_binary_name = data_utils.rand_name('job-fake') + script_name = '' if job_internal: fd, script_name = tempfile.mkstemp() with fdopen(fd, 'w+') as jb: @@ -48,11 +50,10 @@ class SaharaJobBinaryCLITest(base.ClientTestBase): 'Field', 'Value' ]) - if job_internal: - remove(script_name) - return job_binary_name + return job_binary_name, script_name - def openstack_job_binary_download(self, job_binary_name): + def openstack_job_binary_download(self, job_binary_name, + original_file=None): if path.exists(job_binary_name): remove(job_binary_name) @@ -60,6 +61,9 @@ class SaharaJobBinaryCLITest(base.ClientTestBase): params=job_binary_name) self.assertTrue(path.exists(job_binary_name)) + if original_file: + self.assertTrue(cmp(job_binary_name, original_file)) + remove(original_file) remove(job_binary_name) def openstack_job_binary_show(self, job_binary_name): diff --git a/sahara_tempest_plugin/tests/cli/test_scenario.py b/sahara_tempest_plugin/tests/cli/test_scenario.py index 6626f646..e05da3d4 100644 --- a/sahara_tempest_plugin/tests/cli/test_scenario.py +++ b/sahara_tempest_plugin/tests/cli/test_scenario.py @@ -159,13 +159,13 @@ class Scenario(images.SaharaImageCLITest, @testtools.skipIf(TEMPEST_CONF.data_processing.api_version_saharaclient != '1.1', "Full job binaries testing requires API v1.1") def test_job_binary_cli(self): - job_binary_name = self.openstack_job_binary_create() + job_binary_name, original_file = self.openstack_job_binary_create() self.addCleanup(self.delete_resource, 'job binary', job_binary_name) self.openstack_job_binary_list() self.openstack_job_binary_show(job_binary_name) self.openstack_job_binary_update(job_binary_name, flag='description') - self.openstack_job_binary_download(job_binary_name) + self.openstack_job_binary_download(job_binary_name, original_file) self.filter_job_binaries_in_list() self.negative_try_to_update_protected_jb(job_binary_name) self.openstack_job_binary_update(job_binary_name, flag='unprotected') @@ -173,7 +173,8 @@ class Scenario(images.SaharaImageCLITest, self.negative_delete_removed_job_binary(job_binary_name) def test_job_template_cli(self): - job_binary_name = self.openstack_job_binary_create(job_internal=False) + job_binary_name, _ = self.openstack_job_binary_create( + job_internal=False) self.addCleanup(self.delete_resource, 'job binary', job_binary_name) job_template_name = self.openstack_job_template_create(job_binary_name) diff --git a/sahara_tempest_plugin/tests/clients/test_job_binaries.py b/sahara_tempest_plugin/tests/clients/test_job_binaries.py index fa192fb2..20a8bbc8 100644 --- a/sahara_tempest_plugin/tests/clients/test_job_binaries.py +++ b/sahara_tempest_plugin/tests/clients/test_job_binaries.py @@ -85,7 +85,7 @@ class JobBinariesTest(base.BaseDataProcessingTest): def _check_internal_db_job_binary_create(self): name = data_utils.rand_name('sahara-internal-job-binary') - self.job_binary_data = 'Some data' + self.job_binary_data = b'Some data' job_binary_internal = ( self.create_job_binary_internal(name, self.job_binary_data)) self.internal_db_binary_with_extra = { diff --git a/sahara_tempest_plugin/tests/clients/test_job_binary_internals.py b/sahara_tempest_plugin/tests/clients/test_job_binary_internals.py index b0f2189a..653408fd 100644 --- a/sahara_tempest_plugin/tests/clients/test_job_binary_internals.py +++ b/sahara_tempest_plugin/tests/clients/test_job_binary_internals.py @@ -31,7 +31,7 @@ class JobBinaryInternalsTest(base.BaseDataProcessingTest): def _check_job_binary_internal_create(self): name = data_utils.rand_name('sahara-internal-job-binary') - self.job_binary_data = 'Some data' + self.job_binary_data = b'Some data' # create job binary internal resp_body = self.create_job_binary_internal(name, self.job_binary_data) # check that job_binary_internal created successfully