summaryrefslogtreecommitdiffstats
path: root/ctdb/tests/simple/01_ctdb_version.sh
blob: 2e4ef187f34dc716c17c790bc8bf9f59856abaf4 (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
#!/bin/bash

test_info()
{
    cat <<EOF
Verify the output of the 'ctdb version' command.

This test assumes an RPM-based installation and needs to be skipped on
non-RPM systems.

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. Run the 'ctdb version' command on one of the cluster nodes.
3. Compare the version displayed with that listed by the rpm command
   for the ctdb package.

Expected results:

* The 'ctdb version' command displays the ctdb version number.
EOF
}

. ctdb_test_functions.bash

ctdb_test_init "$@"

set -e

onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy

if ! try_command_on_node -v 0 "rpm -q ctdb" ; then
    echo "No useful output from rpm, SKIPPING rest of test".
    exit 0
fi
rpm_ver="${out#ctdb-}"

try_command_on_node -v 0 "ctdb version"
ctdb_ver="${out#CTDB version: }"

if [ "$ctdb_ver" = "$rpm_ver" ] ; then
    echo "OK: CTDB version = RPM version"
else
    echo "BAD: CTDB version != RPM version"
    testfailures=1
fi

ctdb_test_exit