]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add some tests for the console module
authorZack Cerza <zack@redhat.com>
Tue, 23 Aug 2016 21:27:49 +0000 (15:27 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 30 Aug 2016 16:47:03 +0000 (10:47 -0600)
... better late than never?

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/orchestra/test/test_console.py [new file with mode: 0644]

diff --git a/teuthology/orchestra/test/test_console.py b/teuthology/orchestra/test/test_console.py
new file mode 100644 (file)
index 0000000..297f347
--- /dev/null
@@ -0,0 +1,37 @@
+from teuthology.config import config as teuth_config
+
+from .. import console
+
+
+class TestConsole(object):
+    pass
+
+
+class TestPhysicalConsole(TestConsole):
+    klass = console.PhysicalConsole
+
+    def setup(self):
+        teuth_config.ipmi_domain = 'ipmi_domain'
+        teuth_config.ipmi_user = 'ipmi_user'
+        teuth_config.ipmi_password = 'ipmi_pass'
+        self.hostname = 'host'
+
+    def test_build_command(self):
+        cmd_templ = 'ipmitool -H {h}.{d} -I lanplus -U {u} -P {p} {c}'
+        cons = self.klass(
+            self.hostname,
+            teuth_config.ipmi_user,
+            teuth_config.ipmi_password,
+            teuth_config.ipmi_domain,
+        )
+        sol_cmd = cons._build_command('sol activate')
+        assert sol_cmd == cmd_templ.format(
+            h=self.hostname,
+            d=teuth_config.ipmi_domain,
+            u=teuth_config.ipmi_user,
+            p=teuth_config.ipmi_password,
+            c='sol activate',
+        )
+        pc_cmd = cons._build_command('power cycle')
+        assert pc_cmd == sol_cmd.replace('sol activate', 'power cycle')
+