Skip to content

Commit 3e5a2d2

Browse files
zh-fDean Troyeremonty
authored andcommitted
Fix broken gate jobs
This patch aims at fixing the broken gate jobs because of cinder and glance patches [1], [2], [3] and [4]. * Remove parameter `--source-replicated` to drop volume replication v1 support * Address some timing issues with volume transfer requests * Only run Image v1 tests when the test cloud has v1 available * Get tolerant of unexpected additional attributes being returned in Image data [1].https://review.openstack.org/#/c/586293/ [2].https://review.openstack.org/#/c/532503/ [3].https://review.openstack.org/#/c/533564/ [4].https://review.openstack.org/#/c/578755/ Co-Authored-By: Dean Troyer <dtroyer@gmail.com> Co-Authored-By: Monty Taylor <mordred@inaugust.com> Depends-on: https://review.openstack.org/588664 Change-Id: I2a785750e92155185d3344e6116c7f5c6fdd3cbe Signed-off-by: Fan Zhang <zh.f@outlook.com> (cherry picked from commit def83a0)
1 parent 2e51d3b commit 3e5a2d2

9 files changed

Lines changed: 160 additions & 176 deletions

File tree

doc/source/cli/command-objects/volume.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Create new volume
1515
openstack volume create
1616
[--size <size>]
1717
[--type <volume-type>]
18-
[--image <image> | --snapshot <snapshot> | --source <volume> | --source-replicated <replicated-volume>]
18+
[--image <image> | --snapshot <snapshot> | --source <volume> ]
1919
[--description <description>]
2020
[--user <user>]
2121
[--project <project>]
@@ -31,7 +31,7 @@ Create new volume
3131
.. option:: --size <size>
3232

3333
Volume size in GB
34-
(Required unless --snapshot or --source or --source-replicated is specified)
34+
(Required unless --snapshot or --source is specified)
3535

3636
.. option:: --type <volume-type>
3737

@@ -54,10 +54,6 @@ Create new volume
5454

5555
Volume to clone (name or ID)
5656

57-
.. option:: --source-replicated <replicated-volume>
58-
59-
Replicated volume to clone (name or ID)
60-
6157
.. option:: --description <description>
6258

6359
Volume description
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
from openstackclient.tests.functional import base
14+
15+
16+
class BaseImageTests(base.TestCase):
17+
"""Functional tests for Image commands"""
18+
19+
@classmethod
20+
def setUpClass(cls):
21+
super(BaseImageTests, cls).setUpClass()
22+
# TODO(dtroyer): maybe do image API discovery here to determine
23+
# what is available, it isn't in the service catalog
24+
cls.haz_v1_api = False

openstackclient/tests/functional/image/v1/test_image.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,47 @@
1515

1616
import fixtures
1717

18-
from openstackclient.tests.functional import base
18+
from openstackclient.tests.functional.image import base
1919

2020

21-
class ImageTests(base.TestCase):
22-
"""Functional tests for image. """
21+
class ImageTests(base.BaseImageTests):
22+
"""Functional tests for Image commands"""
2323

24-
NAME = uuid.uuid4().hex
25-
OTHER_NAME = uuid.uuid4().hex
24+
def setUp(self):
25+
super(ImageTests, self).setUp()
26+
if not self.haz_v1_api:
27+
self.skipTest('No Image v1 API present')
2628

27-
@classmethod
28-
def setUpClass(cls):
29-
super(ImageTests, cls).setUpClass()
30-
json_output = json.loads(cls.openstack(
29+
self.name = uuid.uuid4().hex
30+
json_output = json.loads(self.openstack(
3131
'--os-image-api-version 1 '
3232
'image create -f json ' +
33-
cls.NAME
33+
self.name
3434
))
35-
cls.image_id = json_output["id"]
36-
cls.assertOutput(cls.NAME, json_output['name'])
35+
self.image_id = json_output["id"]
36+
self.assertOutput(self.name, json_output['name'])
37+
38+
ver_fixture = fixtures.EnvironmentVariable(
39+
'OS_IMAGE_API_VERSION', '1'
40+
)
41+
self.useFixture(ver_fixture)
3742

38-
@classmethod
39-
def tearDownClass(cls):
43+
def tearDown(self):
4044
try:
41-
cls.openstack(
45+
self.openstack(
4246
'--os-image-api-version 1 '
4347
'image delete ' +
44-
cls.image_id
48+
self.image_id
4549
)
4650
finally:
47-
super(ImageTests, cls).tearDownClass()
48-
49-
def setUp(self):
50-
super(ImageTests, self).setUp()
51-
ver_fixture = fixtures.EnvironmentVariable(
52-
'OS_IMAGE_API_VERSION', '1'
53-
)
54-
self.useFixture(ver_fixture)
51+
super(ImageTests, self).tearDown()
5552

5653
def test_image_list(self):
5754
json_output = json.loads(self.openstack(
5855
'image list -f json '
5956
))
6057
self.assertIn(
61-
self.NAME,
58+
self.name,
6259
[img['Name'] for img in json_output]
6360
)
6461

@@ -72,11 +69,11 @@ def test_image_attributes(self):
7269
'--min-ram 5 ' +
7370
'--disk-format qcow2 ' +
7471
'--public ' +
75-
self.NAME
72+
self.name
7673
)
7774
json_output = json.loads(self.openstack(
7875
'image show -f json ' +
79-
self.NAME
76+
self.name
8077
))
8178
self.assertEqual(
8279
4,
@@ -100,11 +97,11 @@ def test_image_attributes(self):
10097
'--property a=b ' +
10198
'--property c=d ' +
10299
'--public ' +
103-
self.NAME
100+
self.name
104101
)
105102
json_output = json.loads(self.openstack(
106103
'image show -f json ' +
107-
self.NAME
104+
self.name
108105
))
109106
self.assertEqual(
110107
"a='b', c='d'",

0 commit comments

Comments
 (0)