libndr: Avoid assigning duplicate versions to symbols
[amitay/samba.git] / ctdb / tests / INTEGRATION / simple / cluster.091.version_check.sh
1 #!/usr/bin/env bash
2
3 # Check that the CTDB version consistency checking operates correctly
4
5 . "${TEST_SCRIPTS_DIR}/integration.bash"
6
7 set -e
8
9 ctdb_test_skip_on_cluster
10
11 ctdb_test_init
12
13 select_test_node
14
15 try_command_on_node -v "$test_node" ctdb version
16 version="$out"
17
18 major="${version%%.*}"
19 rest="${version#*.}"
20 minor="${rest%%.*}"
21
22 echo "Node ${test_node} has version ${major}.${minor}"
23
24 # Unchanged version - this should work
25 export CTDB_TEST_SAMBA_VERSION=$(( (major << 16) | minor ))
26 printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
27        "$test_node" \
28        "$CTDB_TEST_SAMBA_VERSION"
29 ctdb_nodes_restart "$test_node"
30 wait_until_ready
31 echo "GOOD: ctdbd restarted successfully on node ${test_node}"
32
33 d="$CTDB_SCRIPTS_HELPER_BINDIR"
34 try_command_on_node "$test_node" "${d}/ctdb-path" "pidfile" "ctdbd"
35 pidfile="$out"
36
37 # Changed major version - this should fail
38 export CTDB_TEST_SAMBA_VERSION=$(( ((major + 1) << 16) | minor ))
39 printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
40        "$test_node" \
41        "$CTDB_TEST_SAMBA_VERSION"
42 ctdb_nodes_restart "$test_node"
43 echo "Will use PID file ${pidfile} to check for ctdbd exit"
44 wait_until 30 ! test -f "$pidfile"
45 echo "GOOD: ctdbd exited early on node ${test_node}"
46
47 # Changed minor version - this should fail
48 export CTDB_TEST_SAMBA_VERSION=$(( (major << 16) | (minor + 1) ))
49 printf '\nRestarting node %d with CTDB_TEST_SAMBA_VERSION=0x%08x\n' \
50        "$test_node" \
51        "$CTDB_TEST_SAMBA_VERSION"
52 ctdb_nodes_start "$test_node"
53 echo "Will use PID file ${pidfile} to check for ctdbd exit"
54 wait_until 30 ! test -f "$pidfile"
55 echo "GOOD: ctdbd exited early on node ${test_node}"