summaryrefslogtreecommitdiff
path: root/ctdb/tests/INTEGRATION/simple/cluster.091.version_check.sh
blob: fa934e8bef1d55db65944af15edbc37be6d7ad47 (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
#!/bin/bash

test_info()
{
    cat <<EOF
Check that the CTDB version consistency checking operates correctly.
EOF
}

. "${TEST_SCRIPTS_DIR}/integration.bash"

set -e

ctdb_test_skip_on_cluster

ctdb_test_init

cluster_is_healthy

select_test_node

try_command_on_node -v "$test_node" ctdb version
version="$out"

major="${version%%.*}"
rest="${version#*.}"
minor="${rest%%.*}"

echo "Node ${test_node} has version ${major}.${minor}"

# Unchanged version - this should work
export CTDB_TEST_SAMBA_VERSION=$(( (major << 16) | minor ))
printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
       "$test_node" \
       "$CTDB_TEST_SAMBA_VERSION"
ctdb_nodes_restart "$test_node"
wait_until_ready
echo "GOOD: ctdbd restarted successfully on node ${test_node}"

d="$CTDB_SCRIPTS_HELPER_BINDIR"
try_command_on_node "$test_node" "${d}/ctdb-path" "pidfile" "ctdbd"
pidfile="$out"

# Changed major version - this should fail
export CTDB_TEST_SAMBA_VERSION=$(( ((major + 1) << 16) | minor ))
printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
       "$test_node" \
       "$CTDB_TEST_SAMBA_VERSION"
ctdb_nodes_restart "$test_node"
echo "Will use PID file ${pidfile} to check for ctdbd exit"
wait_until 30 ! test -f "$pidfile"
echo "GOOD: ctdbd exited early on node ${test_node}"

# Changed minor version - this should fail
export CTDB_TEST_SAMBA_VERSION=$(( (major << 16) | (minor + 1) ))
printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
       "$test_node" \
       "$CTDB_TEST_SAMBA_VERSION"
ctdb_nodes_start "$test_node"
echo "Will use PID file ${pidfile} to check for ctdbd exit"
wait_until 30 ! test -f "$pidfile"
echo "GOOD: ctdbd exited early on node ${test_node}"