Browse Source

Merge "Add freezer_tempest_scheduler job"

Zuul 5 months ago
parent
commit
120b741822

+ 10
- 0
.zuul.yaml View File

@@ -6,12 +6,14 @@
6 6
       jobs:
7 7
         - freezer-tempest-basic
8 8
         - freezer-tempest-client
9
+        - freezer-tempest-scheduler
9 10
 
10 11
     gate:
11 12
       queue: freezer
12 13
       jobs:
13 14
         - freezer-tempest-basic
14 15
         - freezer-tempest-client
16
+        - freezer-tempest-scheduler
15 17
 
16 18
 - job:
17 19
     name: freezer-tempest-basic
@@ -53,3 +55,11 @@
53 55
     voting: true
54 56
     vars:
55 57
       tempest_test_regex: freezer_tempest_plugin.tests.freezerclient
58
+
59
+- job:
60
+    name: freezer-tempest-scheduler
61
+    parent: freezer-tempest-basic
62
+    voting: true
63
+    vars:
64
+      tempest_test_regex: freezer_tempest_plugin.tests.scheduler
65
+

+ 0
- 0
freezer_tempest_plugin/tests/scheduler/__init__.py View File


+ 81
- 0
freezer_tempest_plugin/tests/scheduler/base.py View File

@@ -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.
14
+import os
15
+import subprocess
16
+from tempest import test
17
+
18
+
19
+class 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))

+ 57
- 0
freezer_tempest_plugin/tests/scheduler/test_freezer_scheduler.py View File

@@ -0,0 +1,57 @@
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.
14
+from freezer_tempest_plugin.tests.scheduler import base
15
+from tempest.lib import decorators
16
+
17
+
18
+class 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_schedulers_restart(self):
31
+        args = ['freezer-scheduler', 'restart']
32
+
33
+        self.run_subprocess(args, "Freezer scheduler restart.")
34
+
35
+    @decorators.attr(type="gate")
36
+    def test_freezer_schedulers_stop(self):
37
+        args = ['freezer-scheduler', 'stop']
38
+
39
+        self.run_subprocess(args, "Freezer scheduler stop")
40
+
41
+    @decorators.attr(type="gate")
42
+    def test_freezer_schedulers_start(self):
43
+        args = ['freezer-scheduler', 'start']
44
+
45
+        self.run_subprocess(args, "Freezer scherduler start")
46
+
47
+    @decorators.attr(type="gate")
48
+    def test_freezer_schedulers_reload(self):
49
+        args = ['freezer-scheduler', 'reload']
50
+
51
+        self.run_subprocess(args, "Freezer scheduler reload")
52
+
53
+    @decorators.attr(type="gate")
54
+    def test_freezer_schedulers_status(self):
55
+        args = ['freezer-scheduler', 'status']
56
+
57
+        self.run_subprocess(args, "Freezer scheduler status")

Loading…
Cancel
Save