Revision 8201b996 qa/qa_daemon.py

b/qa/qa_daemon.py
1 1
#
2 2
#
3 3

  
4
# Copyright (C) 2007 Google Inc.
4
# Copyright (C) 2007, 2008, 2009, 2010 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
32 32
import qa_utils
33 33
import qa_error
34 34

  
35
from qa_utils import AssertEqual, StartSSH
35
from qa_utils import AssertEqual, AssertMatch, StartSSH, GetCommandOutput
36 36

  
37 37

  
38 38
def _InstanceRunning(node, name):
......
89 89
  """
90 90
  master = qa_config.GetMasterNode()
91 91

  
92
  cmd = ['ganeti-watcher', '-d']
93
  AssertEqual(StartSSH(master['primary'],
92
  cmd = ["ganeti-watcher", "-d", "--ignore-pause"]
93
  AssertEqual(StartSSH(master["primary"],
94 94
                       utils.ShellQuoteArgs(cmd)).wait(), 0)
95 95

  
96 96

  
97
def PrintCronWarning():
98
  """Shows a warning about the cron job.
97
def TestPauseWatcher():
98
  """Tests and pauses the watcher.
99 99

  
100 100
  """
101
  msg = ("For the following tests it's recommended to turn off the"
102
         " ganeti-watcher cronjob.")
103
  print
104
  print qa_utils.FormatWarning(msg)
101
  master = qa_config.GetMasterNode()
102

  
103
  cmd = ["gnt-cluster", "watcher", "pause", "4h"]
104
  AssertEqual(StartSSH(master["primary"],
105
                       utils.ShellQuoteArgs(cmd)).wait(), 0)
106

  
107
  cmd = ["gnt-cluster", "watcher", "info"]
108
  output = GetCommandOutput(master["primary"],
109
                            utils.ShellQuoteArgs(cmd))
110
  AssertMatch(output, r"^.*\bis paused\b.*")
111

  
112

  
113
def TestResumeWatcher():
114
  """Tests and unpauses the watcher.
115

  
116
  """
117
  master = qa_config.GetMasterNode()
118

  
119
  cmd = ["gnt-cluster", "watcher", "continue"]
120
  AssertEqual(StartSSH(master["primary"],
121
                       utils.ShellQuoteArgs(cmd)).wait(), 0)
122

  
123
  cmd = ["gnt-cluster", "watcher", "info"]
124
  output = GetCommandOutput(master["primary"],
125
                            utils.ShellQuoteArgs(cmd))
126
  AssertMatch(output, r"^.*\bis not paused\b.*")
105 127

  
106 128

  
107 129
def TestInstanceAutomaticRestart(node, instance):

Also available in: Unified diff