blob: 39e5cd658cc3706f708b1d9f18f99ef2d6c9876e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
define_test "eventscript directory with links"
setup_eventd
ok <<EOF
01.dummy
02.disabled
03.notalink
EOF
simple_test script list data
# Should be a no-op
ok_null
simple_test script disable data 03.notalink
ok_null
simple_test run 10 data failure
ok_null
simple_test script enable data 01.dummy
required_result 8 <<EOF
Event failure in data failed
EOF
simple_test run 10 data failure
ok <<EOF
* 01.dummy
02.disabled
03.notalink
EOF
simple_test script list data
required_result 1 <<EOF
01.dummy ERROR DURATION DATETIME
OUTPUT:
EOF
simple_test status data failure
ok_null
simple_test run 10 data monitor
ok <<EOF
01.dummy OK DURATION DATETIME
03.notalink DISABLED
EOF
simple_test status data monitor
ok_null
simple_test script enable data 03.notalink
ok <<EOF
* 01.dummy
02.disabled
* 03.notalink
EOF
simple_test script list data
# Local/3rd-party link, not enabled
touch "${CTDB_BASE}/foo"
chmod 644 "${CTDB_BASE}/foo"
abs_base=$(cd "$CTDB_BASE" && echo "$PWD")
ln -s "${abs_base}/foo" "${CTDB_BASE}/events/data/04.locallink.script"
ok <<EOF
* 01.dummy
02.disabled
* 03.notalink
04.locallink
EOF
simple_test script list data
ok_null
simple_test script enable data 04.locallink
required_result 1 ""
unit_test test -x "${CTDB_BASE}/foo"
ok_null
simple_test script disable data 04.locallink
ok_null
unit_test test -f "${CTDB_BASE}/foo"
ok <<EOF
* 01.dummy
02.disabled
* 03.notalink
EOF
simple_test script list data
# Local/3rd-party link, enabled
chmod +x "${CTDB_BASE}/foo"
ln -s "${abs_base}/foo" "${CTDB_BASE}/events/data/04.locallink.script"
ok <<EOF
* 01.dummy
02.disabled
* 03.notalink
* 04.locallink
EOF
simple_test script list data
ok_null
simple_test script disable data 01.dummy
ok_null
simple_test script disable data 04.locallink
ok_null
unit_test test -f "${CTDB_BASE}/foo"
ok <<EOF
01.dummy
02.disabled
* 03.notalink
EOF
simple_test script list data
ok_null
simple_test run 10 data failure
# Local/3rd-party link, dangling
ln -s "${CTDB_BASE}/doesnotexist" "${CTDB_BASE}/events/data/04.locallink.script"
ok <<EOF
01.dummy
02.disabled
* 03.notalink
04.locallink
EOF
simple_test script list data
ok_null
simple_test script disable data 04.locallink
ok <<EOF
01.dummy
02.disabled
* 03.notalink
EOF
simple_test script list data
|