6 Verify that 'ctdb getdbmap' operates as expected.
8 This test creates some test databases using 'ctdb attach'.
12 * An active CTDB cluster with at least 2 active nodes.
16 1. Verify that the status on all of the ctdb nodes is 'OK'.
17 2. Get the database on using 'ctdb getdbmap'.
18 3. Verify that the output is valid.
22 * 'ctdb getdbmap' shows a valid listing of databases.
26 . "${TEST_SCRIPTS_DIR}/integration.bash"
34 make_temp_db_filename ()
36 dd if=/dev/urandom count=1 bs=512 2>/dev/null |
38 awk '{printf "%s.tdb\n", $1}'
41 try_command_on_node -v 0 "$CTDB getdbmap"
43 db_map_pattern='^(Number of databases:[[:digit:]]+|dbid:0x[[:xdigit:]]+ name:[^[:space:]]+ path:[^[:space:]]+)$'
45 sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
47 num_db_init=$(sed -n -e '1s/.*://p' "$outfile")
49 for i in $(seq 1 5) ; do
50 f=$(make_temp_db_filename)
51 echo "Creating test database: $f"
52 try_command_on_node 0 $CTDB attach "$f"
53 try_command_on_node 0 $CTDB getdbmap
54 sanity_check_output $(($num_db_init + 1)) "$dbmap_pattern"
55 num=$(sed -n -e '1s/^.*://p' "$outfile")
56 if [ $num = $(($num_db_init + $i)) ] ; then
57 echo "OK: correct number of additional databases"
59 echo "BAD: no additional database"
62 if awk '{print $2}' "$outfile" | grep -Fqx "name:$f" ; then
63 echo "OK: getdbmap knows about \"$f\""
65 echo "BAD: getdbmap does not know about \"$f\""