blob: 32d6d26a4fff6fc61c0e28272064cc205f7889dd (
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
|
#!/bin/bash
test_info()
{
cat <<EOF
Verify that 'ctdb getdbmap' operates as expected.
This test creates some test databases using 'ctdb attach'.
Prerequisites:
* An active CTDB cluster with at least 2 active nodes.
Steps:
1. Verify that the status on all of the ctdb nodes is 'OK'.
2. Get the database on using 'ctdb getdbmap'.
3. Verify that the output is valid.
Expected results:
* 'ctdb getdbmap' shows a valid listing of databases.
EOF
}
. "${TEST_SCRIPTS_DIR}/integration.bash"
ctdb_test_init
set -e
cluster_is_healthy
make_temp_db_filename ()
{
dd if=/dev/urandom count=1 bs=512 2>/dev/null |
md5sum |
awk '{printf "%s.tdb\n", $1}'
}
try_command_on_node -v 0 "$CTDB getdbmap"
db_map_pattern='^(Number of databases:[[:digit:]]+|dbid:0x[[:xdigit:]]+ name:[^[:space:]]+ path:[^[:space:]]+)$'
sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
num_db_init=$(sed -n -e '1s/.*://p' "$outfile")
for i in $(seq 1 5) ; do
f=$(make_temp_db_filename)
echo "Creating test database: $f"
try_command_on_node 0 $CTDB attach "$f"
try_command_on_node 0 $CTDB getdbmap
sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
num=$(sed -n -e '1s/^.*://p' "$outfile")
if [ $num = $(($num_db_init + $i)) ] ; then
echo "OK: correct number of additional databases"
else
echo "BAD: no additional database"
exit 1
fi
if awk '{print $2}' "$outfile" | grep -Fqx "name:$f" ; then
echo "OK: getdbmap knows about \"$f\""
else
echo "BAD: getdbmap does not know about \"$f\""
exit 1
fi
done
|