Browse Source

Merge "Add integration test cases for freezerclient.action"

Zuul 5 months ago
parent
commit
a3a85f09bf

+ 1
- 1
freezer_tempest_plugin/tests/freezerclient/base.py View File

@@ -75,7 +75,7 @@ class BaseFreezerTest(test.BaseTestCase):
75 75
         self.assertEqual(0, proc.returncode,
76 76
                          fail_message + " Output: {0}. "
77 77
                                         "Error: {1}".format(out, err))
78
-
79 78
 #        self.assertEqual('', err,
80 79
 #                         fail_message + " Output: {0}. "
81 80
 #                                        "Error: {1}".format(out, err))
81
+        return out, err

+ 51
- 1
freezer_tempest_plugin/tests/freezerclient/test_freezer_cmd_action.py View File

@@ -11,9 +11,11 @@
11 11
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 12
 # License for the specific language governing permissions and limitations
13 13
 # under the License.
14
-from freezer_tempest_plugin.tests.freezerclient import base
14
+import os
15 15
 from tempest.lib import decorators
16 16
 
17
+from freezer_tempest_plugin.tests.freezerclient import base
18
+
17 19
 
18 20
 class TestFreezerCmdAction(base.BaseFreezerTest):
19 21
     def __init__(self, *args, **kwargs):
@@ -21,13 +23,61 @@ class TestFreezerCmdAction(base.BaseFreezerTest):
21 23
 
22 24
     def setUp(self):
23 25
         super(TestFreezerCmdAction, self).setUp()
26
+        test_action_id = '{\
27
+            "freezer_action":\
28
+             {\
29
+               "action": "backup",\
30
+               "mode": "fs",\
31
+               "src_file": "/tmp/source",\
32
+               "backup_name": "my-first-backup",\
33
+               "container": "/tmp/backup/",\
34
+               "storage": "local"\
35
+              },\
36
+             "max_retries": 3,\
37
+             "max_retries_interval": 60\
38
+        }'
24 39
         self.environ = super(TestFreezerCmdAction, self).get_environ()
40
+        self.filename = '/tmp/test_action.json'
41
+        if os.path.exists(self.filename):
42
+            os.remove(self.filename)
43
+        os.mknod(self.filename)
44
+        fp = open(self.filename, 'w')
45
+        fp.write(test_action_id)
25 46
 
26 47
     def tearDown(self):
27 48
         super(TestFreezerCmdAction, self).tearDown()
28 49
 
50
+    @decorators.attr(type="gate")
51
+    def test_freezer_cmd_actioncreate(self):
52
+        args = ['freezer', 'action-create', '--file',
53
+                self.filename]
54
+
55
+        self.run_subprocess(args, "Create a new action")
56
+
29 57
     @decorators.attr(type="gate")
30 58
     def test_freezer_cmd_actionlist(self):
31 59
         args = ['freezer', 'action-list']
32 60
 
33 61
         self.run_subprocess(args, "List all actions")
62
+
63
+    @decorators.attr(type="gate")
64
+    def test_freezer_cmd_actionshow(self):
65
+        args = ['freezer', 'action-create', '--file',
66
+                self.filename]
67
+        out, err = self.run_subprocess(args, "Create a new action")
68
+        action_id = err.split(' ')[1]
69
+
70
+        args = ['freezer', 'action-show', action_id]
71
+
72
+        self.run_subprocess(args, "show a action")
73
+
74
+    @decorators.attr(type="gate")
75
+    def test_freezer_cmd_actiondelete(self):
76
+        args = ['freezer', 'action-create', '--file',
77
+                self.filename]
78
+        out, err = self.run_subprocess(args, "Create a new action")
79
+        action_id = err.split(' ')[1]
80
+
81
+        args = ['freezer', 'action-delete', action_id]
82
+
83
+        self.run_subprocess(args, "delete a action")

Loading…
Cancel
Save