From: Sebastian Wagner Date: Thu, 11 Jun 2020 10:17:53 +0000 (+0200) Subject: qa/cephadm: Add test for --format=yaml X-Git-Tag: v15.2.5~147^2~13 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4c77ef70f01ce40574de97fd21a854fe485329a5;p=ceph.git qa/cephadm: Add test for --format=yaml Signed-off-by: Sebastian Wagner (cherry picked from commit 1650257015b9470918f50478a6151f2f40467dd3) --- diff --git a/qa/suites/rados/cephadm/workunits/task/test_orch_cli.yaml b/qa/suites/rados/cephadm/workunits/task/test_orch_cli.yaml index d57b3e47aa2d3..abf511946330c 100644 --- a/qa/suites/rados/cephadm/workunits/task/test_orch_cli.yaml +++ b/qa/suites/rados/cephadm/workunits/task/test_orch_cli.yaml @@ -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 index 0000000000000..e69de29bb2d1d diff --git a/qa/tasks/cephadm_cases/test_cli.py b/qa/tasks/cephadm_cases/test_cli.py new file mode 100644 index 0000000000000..a953efc7b8846 --- /dev/null +++ b/qa/tasks/cephadm_cases/test_cli.py @@ -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) +