]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/cephadm: Add test for --format=yaml
authorSebastian Wagner <sebastian.wagner@suse.com>
Thu, 11 Jun 2020 10:17:53 +0000 (12:17 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 25 Jun 2020 10:33:19 +0000 (12:33 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
qa/suites/rados/cephadm/workunits/task/test_orch_cli.yaml
qa/tasks/cephadm_cases/__init__.py [new file with mode: 0644]
qa/tasks/cephadm_cases/test_cli.py [new file with mode: 0644]

index d57b3e47aa2d3696b9d367087f7c79344e37205a..abf511946330c430fe78c75eabd818d714b28106 100644 (file)
@@ -15,3 +15,4 @@ tasks:
 - cephfs_test_runner:
     modules:
       - tasks.cephfs.test_nfs
+      - tasks.cephadm_cases.test_cli
diff --git a/qa/tasks/cephadm_cases/__init__.py b/qa/tasks/cephadm_cases/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/qa/tasks/cephadm_cases/test_cli.py b/qa/tasks/cephadm_cases/test_cli.py
new file mode 100644 (file)
index 0000000..a953efc
--- /dev/null
@@ -0,0 +1,37 @@
+import logging
+
+from tasks.mgr.mgr_test_case import MgrTestCase
+
+log = logging.getLogger(__name__)
+
+
+class TestCephadmCLI(MgrTestCase):
+    def _cmd(self, *args):
+        return self.mgr_cluster.mon_manager.raw_cluster_cmd(*args)
+
+    def _orch_cmd(self, *args):
+        return self._cmd("orch", *args)
+
+    def setUp(self):
+        super(TestCephadmCLI, self).setUp()
+
+    def test_yaml(self):
+        """
+        to prevent oddities like
+
+        >>> import yaml
+        ... from collections import OrderedDict
+        ... assert yaml.dump(OrderedDict()) == '!!python/object/apply:collections.OrderedDict\\n- []\\n'
+        """
+        out = self._orch_cmd('device', 'ls', '--format', 'yaml')
+        self.assertNotIn('!!python', out)
+
+        out = self._orch_cmd('host', 'ls', '--format', 'yaml')
+        self.assertNotIn('!!python', out)
+
+        out = self._orch_cmd('ls', '--format', 'yaml')
+        self.assertNotIn('!!python', out)
+
+        out = self._orch_cmd('ps', '--format', 'yaml')
+        self.assertNotIn('!!python', out)
+