]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
Add tests for RGW daemon naming 281/head
authorTravis Rhoden <trhoden@redhat.com>
Tue, 12 May 2015 15:37:57 +0000 (11:37 -0400)
committerTravis Rhoden <trhoden@redhat.com>
Tue, 12 May 2015 15:39:49 +0000 (11:39 -0400)
Signed-off-by: Travis Rhoden <trhoden@redhat.com>
ceph_deploy/tests/test_cli_rgw.py [new file with mode: 0644]

diff --git a/ceph_deploy/tests/test_cli_rgw.py b/ceph_deploy/tests/test_cli_rgw.py
new file mode 100644 (file)
index 0000000..ed0a1ac
--- /dev/null
@@ -0,0 +1,38 @@
+import pytest
+import subprocess
+
+import ceph_deploy.rgw as rgw
+
+
+def test_help(tmpdir, cli):
+    with cli(
+        args=['ceph-deploy', 'rgw', '--help'],
+        stdout=subprocess.PIPE,
+        ) as p:
+        result = p.stdout.read()
+    assert 'usage: ceph-deploy rgw' in result
+    assert 'positional arguments' in result
+    assert 'optional arguments' in result
+
+
+def test_bad_no_conf(tmpdir, cli):
+    with tmpdir.join('ceph.conf').open('w'):
+        pass
+    with pytest.raises(cli.Failed) as err:
+        with cli(
+            args=['ceph-deploy', 'rgw'],
+            stderr=subprocess.PIPE,
+            ) as p:
+            result = p.stderr.read()
+    assert 'usage: ceph-deploy rgw' in result
+    assert err.value.status == 2
+
+
+def test_rgw_prefix_auto():
+    daemon = rgw.colon_separated("hostname")
+    assert daemon == ("hostname", "rgw.hostname")
+
+
+def test_rgw_prefix_custom():
+    daemon = rgw.colon_separated("hostname:mydaemon")
+    assert daemon == ("hostname", "rgw.mydaemon")