Skip to content

Commit aa7e58c

Browse files
committed
Functional tests run in many environments
Have the functional tests running with less customization and less shell. This change will allow the functional tests to be run against any cloud set up in the environment. Change-Id: I24f621fbace62273e5a0be24e7af9078c0fc8550
1 parent e288e01 commit aa7e58c

6 files changed

Lines changed: 17 additions & 81 deletions

File tree

.testr.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
33
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
44
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
5-
${PYTHON:-python} -m subunit.run discover -t ./ ./openstackclient/tests $LISTOPT $IDOPTION
5+
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./openstackclient/tests} $LISTOPT $IDOPTION
66

77
test_id_option=--load-list $IDFILE
88
test_list_option=--list

functional/harpoon.sh

Lines changed: 0 additions & 37 deletions
This file was deleted.

functional/harpoonrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

functional/tests/object/v1/test_object.py

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,63 +32,45 @@ def setUp(self):
3232
with open(self.OBJECT_NAME, 'w') as f:
3333
f.write('test content')
3434

35-
def test_container_create(self):
35+
def test_object(self):
3636
raw_output = self.openstack('container create ' + self.CONTAINER_NAME)
3737
items = self.parse_listing(raw_output)
3838
self.assert_show_fields(items, CONTAINER_FIELDS)
3939

40-
def test_container_delete(self):
41-
container_tmp = uuid.uuid4().hex
42-
self.openstack('container create ' + container_tmp)
43-
raw_output = self.openstack('container delete ' + container_tmp)
44-
self.assertEqual(0, len(raw_output))
45-
46-
def test_container_list(self):
4740
raw_output = self.openstack('container list')
4841
items = self.parse_listing(raw_output)
4942
self.assert_table_structure(items, BASIC_LIST_HEADERS)
5043

51-
def test_container_show(self):
5244
self.openstack('container show ' + self.CONTAINER_NAME)
5345
# TODO(stevemar): Assert returned fields
5446

55-
def test_container_save(self):
5647
self.openstack('container save ' + self.CONTAINER_NAME)
5748
# TODO(stevemar): Assert returned fields
5849

59-
def test_object_create(self):
6050
raw_output = self.openstack('object create ' + self.CONTAINER_NAME
6151
+ ' ' + self.OBJECT_NAME)
6252
items = self.parse_listing(raw_output)
6353
self.assert_show_fields(items, OBJECT_FIELDS)
6454

65-
def test_object_delete(self):
66-
raw_output = self.openstack('object delete ' + self.CONTAINER_NAME
67-
+ ' ' + self.OBJECT_NAME)
68-
self.assertEqual(0, len(raw_output))
69-
70-
def test_object_list(self):
7155
raw_output = self.openstack('object list ' + self.CONTAINER_NAME)
7256
items = self.parse_listing(raw_output)
7357
self.assert_table_structure(items, BASIC_LIST_HEADERS)
7458

75-
def test_object_save(self):
76-
self.openstack('object create ' + self.CONTAINER_NAME
77-
+ ' ' + self.OBJECT_NAME)
7859
self.openstack('object save ' + self.CONTAINER_NAME
7960
+ ' ' + self.OBJECT_NAME)
8061
# TODO(stevemar): Assert returned fields
8162

82-
def test_object_save_with_filename(self):
83-
self.openstack('object create ' + self.CONTAINER_NAME
84-
+ ' ' + self.OBJECT_NAME)
8563
self.openstack('object save ' + self.CONTAINER_NAME
8664
+ ' ' + self.OBJECT_NAME + ' --file tmp.txt')
8765
# TODO(stevemar): Assert returned fields
8866

89-
def test_object_show(self):
90-
self.openstack('object create ' + self.CONTAINER_NAME
91-
+ ' ' + self.OBJECT_NAME)
9267
self.openstack('object show ' + self.CONTAINER_NAME
9368
+ ' ' + self.OBJECT_NAME)
9469
# TODO(stevemar): Assert returned fields
70+
71+
raw_output = self.openstack('object delete ' + self.CONTAINER_NAME
72+
+ ' ' + self.OBJECT_NAME)
73+
self.assertEqual(0, len(raw_output))
74+
75+
raw_output = self.openstack('container delete ' + self.CONTAINER_NAME)
76+
self.assertEqual(0, len(raw_output))

post_test_hook.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ set -xe
1010

1111
OPENSTACKCLIENT_DIR=$(cd $(dirname "$0") && pwd)
1212

13-
cd $OPENSTACKCLIENT_DIR
1413
echo "Running openstackclient functional test suite"
15-
sudo -H -u stack tox -e functional
14+
sudo -H -u stack -i <<!
15+
source ~stack/devstack/accrc/admin/admin
16+
echo 'Running tests with:'
17+
env | grep OS_
18+
cd ${OPENSTACKCLIENT_DIR}
19+
tox -e functional
20+
!

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ whitelist_externals = bash
1616
commands = flake8
1717

1818
[testenv:functional]
19-
commands = bash -x {toxinidir}/functional/harpoon.sh
19+
setenv = OS_TEST_PATH=./functional/tests
2020

2121
[testenv:venv]
2222
commands = {posargs}

0 commit comments

Comments
 (0)