summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-10-20 08:36:25 +0000
committerGerrit Code Review <review@openstack.org>2018-10-20 08:36:25 +0000
commitd912cb6e677a7ea2ffa11552a1f0235a9cecf6ae (patch)
tree2feb5f916d9f432861832a31bb8ddc1a4b0c330d
parentaaf0d829dd1da5a81d6506ab24fee1606991b010 (diff)
parent9acb56eefb1c0eda737e828b0681c7fd6671e04f (diff)
Merge "Add freezer-tempest-client job"
-rw-r--r--.zuul.yaml9
-rw-r--r--freezer_tempest_plugin/tests/freezerclient/__init__.py0
-rw-r--r--freezer_tempest_plugin/tests/freezerclient/base.py81
-rw-r--r--freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_action.py33
-rw-r--r--freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_backup.py34
-rw-r--r--freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_client.py35
-rw-r--r--freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_job.py35
-rw-r--r--freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_session.py34
8 files changed, 261 insertions, 0 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
index fab48c4..ab51c8a 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -5,11 +5,13 @@
5 check: 5 check:
6 jobs: 6 jobs:
7 - freezer-tempest-basic 7 - freezer-tempest-basic
8 - freezer-tempest-client
8 9
9 gate: 10 gate:
10 queue: freezer 11 queue: freezer
11 jobs: 12 jobs:
12 - freezer-tempest-basic 13 - freezer-tempest-basic
14 - freezer-tempest-client
13 15
14- job: 16- job:
15 name: freezer-tempest-basic 17 name: freezer-tempest-basic
@@ -44,3 +46,10 @@
44 PYTHONUNBUFFERED: 'true' 46 PYTHONUNBUFFERED: 'true'
45 zuul_copy_output: 47 zuul_copy_output:
46 /etc/hosts: logs 48 /etc/hosts: logs
49
50- job:
51 name: freezer-tempest-client
52 parent: freezer-tempest-basic
53 voting: true
54 vars:
55 tempest_test_regex: freezer_tempest_plugin.tests.freezerclient
diff --git a/freezer_tempest_plugin/tests/freezerclient/__init__.py b/freezer_tempest_plugin/tests/freezerclient/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/freezer_tempest_plugin/tests/freezerclient/__init__.py
diff --git a/freezer_tempest_plugin/tests/freezerclient/base.py b/freezer_tempest_plugin/tests/freezerclient/base.py
new file mode 100644
index 0000000..d00957c
--- /dev/null
+++ b/freezer_tempest_plugin/tests/freezerclient/base.py
@@ -0,0 +1,81 @@
1# (C) opyright 2018 ZTE Corporation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14import os
15import subprocess
16from tempest import test
17
18
19class BaseFreezerTest(test.BaseTestCase):
20 credentials = ['primary']
21
22 def __init__(self, *args, **kwargs):
23
24 super(BaseFreezerTest, self).__init__(*args, **kwargs)
25
26 # noinspection PyAttributeOutsideInit
27 def setUp(self):
28 super(BaseFreezerTest, self).setUp()
29 self.get_environ()
30
31 def tearDown(self):
32
33 super(BaseFreezerTest, self).tearDown()
34
35 @classmethod
36 def get_auth_url(cls):
37 return cls.os_primary.auth_provider.auth_client.auth_url[:-len(
38 '/auth/tokens')]
39
40 @classmethod
41 def setup_clients(cls):
42 super(BaseFreezerTest, cls).setup_clients()
43 cls.get_environ()
44
45 @classmethod
46 def get_environ(cls):
47 os.environ['OS_PASSWORD'] = cls.os_primary.credentials.password
48 os.environ['OS_USERNAME'] = cls.os_primary.credentials.username
49 os.environ['OS_PROJECT_NAME'] = cls.os_primary.credentials.project_name
50 os.environ['OS_TENANT_NAME'] = cls.os_primary.credentials.project_name
51 os.environ['OS_PROJECT_DOMAIN_NAME'] = \
52 cls.os_primary.credentials.project_domain_name
53 os.environ['OS_USER_DOMAIN_NAME'] = \
54 cls.os_primary.credentials.user_domain_name
55
56 # Allow developers to set OS_AUTH_URL when developing so that
57 # Keystone may be on a host other than localhost.
58 if 'OS_AUTH_URL' not in os.environ:
59 os.environ['OS_AUTH_URL'] = cls.get_auth_url()
60
61 # Mac OS X uses gtar located in /usr/local/bin
62 os.environ['PATH'] = '/usr/local/bin:' + os.environ['PATH']
63
64 return os.environ
65
66 def run_subprocess(self, sub_process_args, fail_message):
67
68 proc = subprocess.Popen(sub_process_args,
69 stdout=subprocess.PIPE,
70 stderr=subprocess.PIPE,
71 env=self.environ, shell=False)
72
73 out, err = proc.communicate()
74
75 self.assertEqual(0, proc.returncode,
76 fail_message + " Output: {0}. "
77 "Error: {1}".format(out, err))
78
79 self.assertEqual('', err,
80 fail_message + " Output: {0}. "
81 "Error: {1}".format(out, err))
diff --git a/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_action.py b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_action.py
new file mode 100644
index 0000000..2404921
--- /dev/null
+++ b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_action.py
@@ -0,0 +1,33 @@
1# (C) opyright 2018 ZTE Corporation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14from freezer_tempest_plugin.tests.freezerclient import base
15from tempest.lib import decorators
16
17
18class TestFreezerCmdAction(base.BaseFreezerTest):
19 def __init__(self, *args, **kwargs):
20 super(TestFreezerCmdAction, self).__init__(*args, **kwargs)
21
22 def setUp(self):
23 super(TestFreezerCmdAction, self).setUp()
24 self.environ = super(TestFreezerCmdAction, self).get_environ()
25
26 def tearDown(self):
27 super(TestFreezerCmdAction, self).tearDown()
28
29 @decorators.attr(type="gate")
30 def test_freezer_cmd_actionlist(self):
31 args = ['freezer', 'action-list']
32
33 self.run_subprocess(args, "List all actions")
diff --git a/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_backup.py b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_backup.py
new file mode 100644
index 0000000..d960fa3
--- /dev/null
+++ b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_backup.py
@@ -0,0 +1,34 @@
1# (C) Copyright 2018 ZTE corporation
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14from tempest.lib import decorators
15
16from freezer_tempest_plugin.tests.freezerclient import base
17
18
19class TestFreezerCmdBackup(base.BaseFreezerTest):
20 def __init__(self, *args, **kwargs):
21 super(TestFreezerCmdBackup, self).__init__(*args, **kwargs)
22
23 def setUp(self):
24 super(TestFreezerCmdBackup, self).setUp()
25 self.environ = super(TestFreezerCmdBackup, self).get_environ()
26
27 def tearDown(self):
28 super(TestFreezerCmdBackup, self).tearDown()
29
30 @decorators.attr(type="gate")
31 def test_freezer_cmd_backuplist(self):
32 args = ['freezer', 'backup-list']
33
34 self.run_subprocess(args, " List all backups")
diff --git a/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_client.py b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_client.py
new file mode 100644
index 0000000..95b669f
--- /dev/null
+++ b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_client.py
@@ -0,0 +1,35 @@
1# (C) Copyright 2018 ZTE corporation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.lib import decorators
16
17from freezer_tempest_plugin.tests.freezerclient import base
18
19
20class TestFreezerCmdClient(base.BaseFreezerTest):
21 def __init__(self, *args, **kwargs):
22 super(TestFreezerCmdClient, self).__init__(*args, **kwargs)
23
24 def setUp(self):
25 super(TestFreezerCmdClient, self).setUp()
26 self.environ = super(TestFreezerCmdClient, self).get_environ()
27
28 def tearDown(self):
29 super(TestFreezerCmdClient, self).tearDown()
30
31 @decorators.attr(type="gate")
32 def test_freezer_cmd_clientlist(self):
33 args = ['freezer', 'client-list']
34
35 self.run_subprocess(args, "List of clients registered in the api")
diff --git a/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_job.py b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_job.py
new file mode 100644
index 0000000..f8d305e
--- /dev/null
+++ b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_job.py
@@ -0,0 +1,35 @@
1# (C) Copyright 2018 ZTE Corporation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15from tempest.lib import decorators
16
17from freezer_tempest_plugin.tests.freezerclient import base
18
19
20class TestFreezerCmdJob(base.BaseFreezerTest):
21 def __init__(self, *args, **kwargs):
22 super(TestFreezerCmdJob, self).__init__(*args, **kwargs)
23
24 def setUp(self):
25 super(TestFreezerCmdJob, self).setUp()
26 self.environ = super(TestFreezerCmdJob, self).get_environ()
27
28 def tearDown(self):
29 super(TestFreezerCmdJob, self).tearDown()
30
31 @decorators.attr(type="gate")
32 def test_freezer_cmd_joblist(self):
33 args = ['freezer', 'job-list']
34
35 self.run_subprocess(args, "List all the jobs")
diff --git a/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_session.py b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_session.py
new file mode 100644
index 0000000..3500493
--- /dev/null
+++ b/freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_session.py
@@ -0,0 +1,34 @@
1# (C) Copyright 2018 ZTE Corporation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14from tempest.lib import decorators
15
16from freezer_tempest_plugin.tests.freezerclient import base
17
18
19class TestFreezerCmdSession(base.BaseFreezerTest):
20 def __init__(self, *args, **kwargs):
21 super(TestFreezerCmdSession, self).__init__(*args, **kwargs)
22
23 def setUp(self):
24 super(TestFreezerCmdSession, self).setUp()
25 self.environ = super(TestFreezerCmdSession, self).get_environ()
26
27 def tearDown(self):
28 super(TestFreezerCmdSession, self).tearDown()
29
30 @decorators.attr(type="gate")
31 def test_freezer_cmd_sessionlist(self):
32 args = ['freezer', 'session-list']
33
34 self.run_subprocess(args, "List all the sessions")