- Use new --master-netdev parameter on gnt-cluster init
authorMichael Hanselmann <hansmi@google.com>
Wed, 25 Jul 2007 10:12:16 +0000 (10:12 +0000)
committerMichael Hanselmann <hansmi@google.com>
Wed, 25 Jul 2007 10:12:16 +0000 (10:12 +0000)
- Split up info tests and add more of them
- Replace map() by [x for x in y]

Reviewed-by: iustinp

testing/ganeti.qa.py

index 2f585b9..873e468 100755 (executable)
@@ -255,7 +255,7 @@ def TestGanetiCommands():
            ['ganeti-noded', '--version'],
            ['ganeti-watcher', '--version'] )
 
-  cmd = ' && '.join(map(utils.ShellQuoteArgs, cmds))
+  cmd = ' && '.join([utils.ShellQuoteArgs(i) for i in cmds])
 
   for node in cfg['nodes']:
     AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
@@ -273,7 +273,7 @@ def TestIcmpPing():
         check.append(i['secondary'])
 
     ping = lambda ip: utils.ShellQuoteArgs(['ping', '-w', '3', '-c', '1', ip])
-    cmd = ' && '.join(map(ping, check))
+    cmd = ' && '.join([ping(i) for i in check])
 
     AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
 # }}}
@@ -288,6 +288,7 @@ def TestClusterInit():
     cmd.append('--secondary-ip=%s' % master['secondary'])
   if cfg.get('bridge', None):
     cmd.append('--bridge=%s' % cfg['bridge'])
+    cmd.append('--master-netdev=%s' % cfg['bridge'])
   cmd.append(cfg['name'])
 
   AssertEqual(StartSSH(master['primary'],
@@ -328,7 +329,7 @@ def TestClusterBurnin():
     script = UploadFile(master['primary'], '../tools/burnin')
     try:
       cmd = [script, '--os=%s' % cfg['os']]
-      cmd += map(lambda inst: inst['name'], instances)
+      cmd += [inst['name'] for inst in instances]
       AssertEqual(StartSSH(master['primary'],
                            utils.ShellQuoteArgs(cmd)).wait(), 0)
     finally:
@@ -400,6 +401,13 @@ def TestNodeRemoveAll():
   for node in cfg['nodes']:
     if node != master:
       _NodeRemove(node)
+
+
+def TestNodeInfo():
+  """gnt-node info"""
+  cmd = ['gnt-node', 'info']
+  AssertEqual(StartSSH(GetMasterNode()['primary'],
+                       utils.ShellQuoteArgs(cmd)).wait(), 0)
 # }}}
 
 # {{{ Instance tests
@@ -464,6 +472,13 @@ def TestInstanceFailover(instance):
   cmd = ['gnt-instance', 'failover', '--force', instance['name']]
   AssertEqual(StartSSH(GetMasterNode()['primary'],
                        utils.ShellQuoteArgs(cmd)).wait(), 0)
+
+
+def TestInstanceInfo(instance):
+  """gnt-instance info"""
+  cmd = ['gnt-instance', 'info', instance['name']]
+  AssertEqual(StartSSH(GetMasterNode()['primary'],
+                       utils.ShellQuoteArgs(cmd)).wait(), 0)
 # }}}
 
 # {{{ Daemon tests
@@ -633,10 +648,15 @@ if __name__ == '__main__':
 
   if TestEnabled('cluster-verify'):
     RunTest(TestClusterVerify)
+
+  if TestEnabled('cluster-info'):
     RunTest(TestClusterInfo)
 
   RunTest(TestNodeAddAll)
 
+  if TestEnabled('node-info'):
+    RunTest(TestNodeInfo)
+
   if TestEnabled('cluster-burnin'):
     RunTest(TestClusterBurnin)
 
@@ -650,6 +670,9 @@ if __name__ == '__main__':
       RunTest(TestInstanceShutdown, instance)
       RunTest(TestInstanceStartup, instance)
 
+      if TestEnabled('instance-info'):
+        RunTest(TestInstanceInfo, instance)
+
       if TestEnabled('instance-automatic-restart'):
         RunTest(TestInstanceAutomaticRestart, node, instance)
 
@@ -663,6 +686,10 @@ if __name__ == '__main__':
       instance = RunTest(TestInstanceAddWithLocalMirrorDisk, node)
       RunTest(TestInstanceShutdown, instance)
       RunTest(TestInstanceStartup, instance)
+
+      if TestEnabled('instance-info'):
+        RunTest(TestInstanceInfo, instance)
+
       RunTest(TestInstanceRemove, instance)
       del instance
 
@@ -673,6 +700,9 @@ if __name__ == '__main__':
         RunTest(TestInstanceShutdown, instance)
         RunTest(TestInstanceStartup, instance)
 
+        if TestEnabled('instance-info'):
+          RunTest(TestInstanceInfo, instance)
+
         if TestEnabled('instance-failover'):
           RunTest(TestInstanceFailover, instance)