]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
patch socket on tests that call cli directly 29/head
authorAlfredo Deza <alfredo@deza.pe>
Wed, 31 Jul 2013 20:30:10 +0000 (16:30 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Thu, 1 Aug 2013 20:08:22 +0000 (16:08 -0400)
ceph_deploy/tests/test_cli_mon.py
ceph_deploy/tests/test_cli_new.py

index 6df90968e5f89ee0d656708b895aad4fdfbbce28..81aa0450018a937bf50551a8d2fb38cbe3204174 100644 (file)
@@ -73,16 +73,17 @@ mon initial members = host1
     mock_compiled[mon.create_mon].side_effect = _create_mon
 
     try:
-        with mock.patch('socket.getaddrinfo', fake_getaddrinfo):
-            with directory(str(tmpdir)):
-                main(
-                    args=['-v', 'new', 'host1'],
-                    namespace=ns,
-                    )
-                main(
-                    args=['-v', 'mon', 'create', 'host1'],
-                    namespace=ns,
-                    )
+        with mock.patch('ceph_deploy.new.socket.gethostbyname'):
+            with mock.patch('socket.getaddrinfo', fake_getaddrinfo):
+                with directory(str(tmpdir)):
+                    main(
+                        args=['-v', 'new', 'host1'],
+                        namespace=ns,
+                        )
+                    main(
+                        args=['-v', 'mon', 'create', 'host1'],
+                        namespace=ns,
+                        )
     except SystemExit as e:
         raise AssertionError('Unexpected exit: %s', e)
     out, err = capsys.readouterr()
index 182729ee3b47b62d79ea2ad21d24ca6f1ecb1c34..4e926ad1815fecfb7435767d9c3cfc0b8d23f42d 100644 (file)
@@ -22,9 +22,10 @@ def test_help(tmpdir, cli):
 
 
 def test_write_global_conf_section(tmpdir, cli):
-    with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
-        with directory(str(tmpdir)):
-            main(args=['new', 'host1'])
+    with patch('ceph_deploy.new.socket.gethostbyname'):
+        with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
+            with directory(str(tmpdir)):
+                main(args=['new', 'host1'])
     with tmpdir.join('ceph.conf').open() as f:
         cfg = conf.parse(f)
     assert cfg.sections() == ['global']
@@ -35,12 +36,13 @@ def pytest_funcarg__newcfg(request):
     cli = request.getfuncargvalue('cli')
 
     def new(*args):
-        with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
-            with directory(str(tmpdir)):
-                main( args=['new'] + list(args))
-                with tmpdir.join('ceph.conf').open() as f:
-                    cfg = conf.parse(f)
-                return cfg
+        with patch('ceph_deploy.new.socket.gethostbyname'):
+            with patch('ceph_deploy.new.socket.getaddrinfo', fake_getaddrinfo):
+                with directory(str(tmpdir)):
+                    main( args=['new'] + list(args))
+                    with tmpdir.join('ceph.conf').open() as f:
+                        cfg = conf.parse(f)
+                    return cfg
     return new