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