mirror of https://github.com/schoebel/mars
test_suite: remove calls to marsview. We only use marsadm view-1and1.
This commit is contained in:
parent
c2a054cdb6
commit
e21d048709
|
@ -1,65 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function marsview_get
|
|
||||||
{
|
|
||||||
local host=$1 res=$2
|
|
||||||
local result_line check_line
|
|
||||||
local max_rounds=2
|
|
||||||
local tmp_err=/tmp/xx.$$
|
|
||||||
for (( ; ; )); do
|
|
||||||
result_line=($(lib_remote_idfile $host marsview $res | head -1)) || lib_exit 1
|
|
||||||
echo "result_line: ${result_line[*]}" >> /dev/stderr
|
|
||||||
check_line=($(lib_remote_idfile $host marsadm view-1and1 $res 2> $tmp_err | head -1)) || { cat $tmp_err >> /dev/stderr; lib_exit 1; }
|
|
||||||
cat $tmp_err >> /dev/stderr
|
|
||||||
echo "check_line : ${check_line[*]}" >> /dev/stderr
|
|
||||||
lib_remote_idfile $host "marsadm view-1and1 all; marsadm view-the-msg all; marsadm view-the-global-msg; true" >> /dev/stderr 2>&1 || true
|
|
||||||
local a="$(echo "${result_line[*]}")"
|
|
||||||
local b="$(echo "${check_line[*]}")"
|
|
||||||
echo "a: $a" >> /dev/stderr
|
|
||||||
echo "b: $b" >> /dev/stderr
|
|
||||||
if [ "$a" = "$b" ]; then
|
|
||||||
echo "COMPARE OK" >> /dev/stderr
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if grep -q "SPLIT BRAIN" $tmp_err; then
|
|
||||||
echo "COMPARE IGNORED" >> /dev/stderr
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [[ "${check_line[*]}" =~ "PrimaryUnreachable" ]]; then
|
|
||||||
echo "COMPARE UNREACHABLE" >> /dev/stderr
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
if (( max_rounds-- <= 0 )); then
|
|
||||||
echo "EXCEEDED $(date)" >> /dev/stderr
|
|
||||||
lib_remote_idfile $host "find /mars -ls; true" >> /dev/stderr 2>&1 || true
|
|
||||||
echo "SLEEPING $(date)" >> /dev/stderr
|
|
||||||
sleep 1
|
|
||||||
lib_remote_idfile $host "marsadm view-1and1 all; marsadm view-the-msg all; marsadm view-the-global-msg; true" >> /dev/stderr 2>&1 || true
|
|
||||||
local a="$(echo "${result_line[*]}" | sed 's/\[.*\]//')"
|
|
||||||
local b="$(echo "${check_line[*]}" | sed 's/\[.*\]//')"
|
|
||||||
if [ "$a" = "$b" ]; then
|
|
||||||
echo "COMPARE OK" >> /dev/stderr
|
|
||||||
echo "COMPARE FLAGS MISMATCH" >> /dev/stderr
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [[ "$a" =~ "Outdated" && "$b" =~ "Uptodate" ]]; then
|
|
||||||
echo "COMPARE BUG" >> /dev/stderr
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo "COMPARE BAD" >> /dev/stderr
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
rm -f $tmp_err
|
|
||||||
echo "${check_line[*]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
function marsview_check
|
function marsview_check
|
||||||
{
|
{
|
||||||
local host=$1 res=$2 obj=$3 state_req="$4"
|
local host=$1 res=$2 obj=$3 state_req="$4"
|
||||||
local result_line field_no
|
local result_line field_no
|
||||||
result_line=($(marsview_get $host $res))
|
result_line=($(lib_remote_idfile $host marsadm view-1and1 $res)) || \
|
||||||
|
lib_exit 1
|
||||||
field_no=$(marsview_obj_to_field $obj) || lib_exit 1
|
field_no=$(marsview_obj_to_field $obj) || lib_exit 1
|
||||||
local obj_state="${result_line[$field_no]}"
|
local obj_state="${result_line[$field_no]}"
|
||||||
if ! expr "$obj_state" : "\($state_req\)" >/dev/null; then
|
if ! expr "$obj_state" : "\($state_req\)" >/dev/null; then
|
||||||
|
|
Loading…
Reference in New Issue