ctdb-tests: Fix the tests for waf build
[Samba.git] / ctdb / tests / simple / 01_ctdb_version.sh
blob902efa0dfa7fa5c30a5877aa4526a36af42413e5
1 #!/bin/bash
3 test_info()
5 cat <<EOF
6 Verify the output of the 'ctdb version' command.
8 This test assumes an RPM-based installation and needs to be skipped on
9 non-RPM systems.
11 Prerequisites:
13 * An active CTDB cluster with at least 2 active nodes.
15 Steps:
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.
22 Expected results:
24 * The 'ctdb version' command displays the ctdb version number.
25 EOF
28 . "${TEST_SCRIPTS_DIR}/integration.bash"
30 ctdb_test_init "$@"
32 set -e
34 cluster_is_healthy
36 if ! try_command_on_node -v 0 "rpm -qf $0" ; then
37 echo "No useful output from rpm, SKIPPING rest of test".
38 exit 0
40 rpm_ver="${out#ctdb-tests-}"
41 # Some version of RPM append the architecture to the version.
42 # And also remove the release suffix.
43 arch=$(uname -m)
44 rpm_ver="${rpm_ver%-*.${arch}}"
46 try_command_on_node -v 0 "$CTDB version"
47 ctdb_ver="${out#CTDB version: }"
49 if [ "$ctdb_ver" = "$rpm_ver" ] ; then
50 echo "OK: CTDB version = RPM version"
51 else
52 echo "BAD: CTDB version != RPM version"
53 testfailures=1