Statistics
| Branch: | Tag: | Revision:

root / qa / qa_env.py @ 9b3939ea

History | View | Annotate | Download (2.1 kB)

1
# Copyright (C) 2007 Google Inc.
2
#
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.
7
#
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.
12
#
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
16
# 02110-1301, USA.
17

    
18

    
19
"""Cluster environment related QA tests.
20

21
"""
22

    
23
from ganeti import utils
24

    
25
import qa_config
26
import qa_utils
27

    
28
from qa_utils import AssertEqual, StartSSH
29

    
30

    
31
@qa_utils.DefineHook('env-ssh-connection')
32
def TestSshConnection():
33
  """Test SSH connection.
34

35
  """
36
  for node in qa_config.get('nodes'):
37
    AssertEqual(StartSSH(node['primary'], 'exit').wait(), 0)
38

    
39

    
40
@qa_utils.DefineHook('env-ganeti-commands')
41
def TestGanetiCommands():
42
  """Test availibility of Ganeti commands.
43

44
  """
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'] )
52

    
53
  cmd = ' && '.join([utils.ShellQuoteArgs(i) for i in cmds])
54

    
55
  for node in qa_config.get('nodes'):
56
    AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
57

    
58

    
59
@qa_utils.DefineHook('env-icmp-ping')
60
def TestIcmpPing():
61
  """ICMP ping each node.
62

63
  """
64
  nodes = qa_config.get('nodes')
65

    
66
  for node in nodes:
67
    check = []
68
    for i in nodes:
69
      check.append(i['primary'])
70
      if i.has_key('secondary'):
71
        check.append(i['secondary'])
72

    
73
    ping = lambda ip: utils.ShellQuoteArgs(['ping', '-w', '3', '-c', '1', ip])
74
    cmd = ' && '.join([ping(i) for i in check])
75

    
76
    AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)