Revision 0f63f1f9

b/test/daemon-util_unittest.bash
1 1
#!/bin/bash
2 2
#
3 3

  
4
# Copyright (C) 2010 Google Inc.
4
# Copyright (C) 2010, 2011 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
......
28 28
  exit 1
29 29
}
30 30

  
31
if ! grep -q '^ENABLE_CONFD = ' lib/_autoconf.py; then
32
  err "Please update $0, confd enable feature is missing"
33
fi
34

  
35
if grep -q '^ENABLE_CONFD = True' lib/_autoconf.py; then
36
  DAEMONS="$(echo ganeti-{noded,masterd,rapi,confd})"
37
  STOPDAEMONS="$(echo ganeti-{confd,rapi,masterd,noded})"
38
else
39
  DAEMONS="$(echo ganeti-{noded,masterd,rapi})"
40
  STOPDAEMONS="$(echo ganeti-{rapi,masterd,noded})"
41
fi
42

  
31 43
$daemon_util >/dev/null 2>&1 &&
32 44
  err "daemon-util succeeded without command"
33 45

  
......
49 61
  err "check-exitcode 11 (not master) didn't return 0"
50 62

  
51 63
tmp=$(echo $($daemon_util list-start-daemons))
52
test "$tmp" == "$(echo ganeti-{noded,masterd,rapi,confd})" ||
64
test "$tmp" == "$DAEMONS" ||
53 65
  err "list-start-daemons didn't return correct list of daemons"
54 66

  
55 67
tmp=$(echo $($daemon_util list-stop-daemons))
56
test "$tmp" == "$(echo ganeti-{confd,rapi,masterd,noded})" ||
68
test "$tmp" == "$STOPDAEMONS" ||
57 69
  err "list-stop-daemons didn't return correct list of daemons"
58 70

  
59 71
$daemon_util is-daemon-name >/dev/null 2>&1 &&
......
64 76
    err "is-daemon-name thinks '$i' is a daemon name"
65 77
done
66 78

  
67
for i in ganeti-{confd,rapi,masterd,noded}; do
79
for i in $DAEMONS; do
68 80
  $daemon_util is-daemon-name $i >/dev/null 2>&1 ||
69 81
    err "is-daemon-name doesn't think '$i' is a daemon name"
70 82
done

Also available in: Unified diff