Statistics
| Branch: | Tag: | Revision:

root / qa / qa_env.py @ cec9845c

History | View | Annotate | Download (1.9 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

    
27
from qa_utils import AssertEqual, StartSSH
28

    
29

    
30
def TestSshConnection():
31
  """Test SSH connection.
32

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

    
37

    
38
def TestGanetiCommands():
39
  """Test availibility of Ganeti commands.
40

41
  """
42
  cmds = ( ['gnt-cluster', '--version'],
43
           ['gnt-os', '--version'],
44
           ['gnt-node', '--version'],
45
           ['gnt-instance', '--version'],
46
           ['gnt-backup', '--version'],
47
           ['ganeti-noded', '--version'],
48
           ['ganeti-watcher', '--version'] )
49

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

    
52
  for node in qa_config.get('nodes'):
53
    AssertEqual(StartSSH(node['primary'], cmd).wait(), 0)
54

    
55

    
56
def TestIcmpPing():
57
  """ICMP ping each node.
58

59
  """
60
  nodes = qa_config.get('nodes')
61

    
62
  for node in nodes:
63
    check = []
64
    for i in nodes:
65
      check.append(i['primary'])
66
      if i.has_key('secondary'):
67
        check.append(i['secondary'])
68

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

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