4 # Copyright (C) 2007 Google Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 """Cluster environment related QA tests.
26 from ganeti import utils
31 from qa_utils import AssertEqual, StartSSH
34 @qa_utils.DefineHook('env-ssh-connection')
35 def TestSshConnection():
36 """Test SSH connection.
39 for node in qa_config.get('nodes'):
40 AssertEqual(StartSSH(node['primary'], 'exit').wait(), 0)
43 @qa_utils.DefineHook('env-ganeti-commands')
44 def TestGanetiCommands():
45 """Test availibility of Ganeti commands.
48 cmds = ( ['gnt-cluster', '--version'],
49 ['gnt-os', '--version'],
50 ['gnt-node', '--version'],
51 ['gnt-instance', '--version'],
52 ['gnt-backup', '--version'],
53 ['ganeti-noded', '--version'],
54 ['ganeti-watcher', '--version'] )
56 cmd = ' && '.join([utils.ShellQuoteArgs(i) for i in cmds])
58 for node in qa_config.get('nodes'):
59 AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
62 @qa_utils.DefineHook('env-icmp-ping')
64 """ICMP ping each node.
67 nodes = qa_config.get('nodes')
72 check.append(i['primary'])
73 if i.has_key('secondary'):
74 check.append(i['secondary'])
76 ping = lambda ip: utils.ShellQuoteArgs(['ping', '-w', '3', '-c', '1', ip])
77 cmd = ' && '.join([ping(i) for i in check])
79 AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)