tests: Rename ctdb_test_functions.bash to integration.bash
[vlendec/samba-autobuild/.git] / ctdb / tests / simple / 01_ctdb_version.sh
1 #!/bin/bash
2
3 test_info()
4 {
5     cat <<EOF
6 Verify the output of the 'ctdb version' command.
7
8 This test assumes an RPM-based installation and needs to be skipped on
9 non-RPM systems.
10
11 Prerequisites:
12
13 * An active CTDB cluster with at least 2 active nodes.
14
15 Steps:
16
17 1. Verify that the status on all of the ctdb nodes is 'OK'.
18 2. Run the 'ctdb version' command on one of the cluster nodes.
19 3. Compare the version displayed with that listed by the rpm command
20    for the ctdb package.
21
22 Expected results:
23
24 * The 'ctdb version' command displays the ctdb version number.
25 EOF
26 }
27
28 . "${TEST_SCRIPTS_DIR}/integration.bash"
29
30 ctdb_test_init "$@"
31
32 set -e
33
34 cluster_is_healthy
35
36 if ! try_command_on_node -v 0 "rpm -q ctdb" ; then
37     echo "No useful output from rpm, SKIPPING rest of test".
38     exit 0
39 fi
40 rpm_ver="${out#ctdb-}"
41 # Some version of RPM append the architecture to the version.
42 arch=$(uname -m)
43 rpm_ver="${rpm_ver%.${arch}}"
44
45 try_command_on_node -v 0 "$CTDB version"
46 ctdb_ver="${out#CTDB version: }"
47
48 if [ "$ctdb_ver" = "$rpm_ver" ] ; then
49     echo "OK: CTDB version = RPM version"
50 else
51     echo "BAD: CTDB version != RPM version"
52     testfailures=1
53 fi