summaryrefslogtreecommitdiff
path: root/tests/ovsdb-cluster.at
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ovsdb-cluster.at')
-rw-r--r--tests/ovsdb-cluster.at126
1 files changed, 63 insertions, 63 deletions
diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at
index b23adc6a5..1c4149155 100644
--- a/tests/ovsdb-cluster.at
+++ b/tests/ovsdb-cluster.at
@@ -15,10 +15,10 @@ ovsdb_check_cluster () {
on_exit 'kill `cat *.pid`'
for i in `seq $n`; do
- AT_CHECK([ovsdb-server -vraft -vconsole:off -vsyslog:off --detach --no-chdir --log-file=s$i.log --pidfile=s$i.pid --unixctl=s$i --remote=punix:s$i.ovsdb s$i.db])
+ AT_CHECK([ovsdb-server -vraft -vconsole:off -vsyslog:off --detach --no-chdir --log-file=s$i.log --pidfile=s$i.pid --unixctl=s$i --remote=punix:s$i.ovsdb s$i.db])
done
for i in `seq $n`; do
- AT_CHECK([ovsdb-client --timeout=30 wait unix:s$i.ovsdb $schema connected])
+ AT_CHECK([ovsdb-client --timeout=30 wait unix:s$i.ovsdb $schema connected])
done
for txn
@@ -28,7 +28,7 @@ ovsdb_check_cluster () {
done
AT_CHECK_UNQUOTED([uuidfilt output], [0], [$output])
for i in `seq $n`; do
- OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/s$i], [s$i.pid])
+ OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/s$i], [s$i.pid])
done
AT_CHECK([ovsdb-tool check-cluster s*.db])
@@ -67,8 +67,8 @@ AT_BANNER([OVSDB - cluster tests])
# Torture test.
OVS_START_SHELL_HELPERS
ovsdb_torture_test () {
- local n=$1 # Number of cluster members
- local victim=$2 # Cluster member to kill or remove
+ local n=$1 # Number of cluster members
+ local victim=$2 # Cluster member to kill or remove
local variant=$3 # 'kill' and restart or 'remove' and add
cp $top_srcdir/ovn/ovn-sb.ovsschema schema
schema=`ovsdb-tool schema-name schema`
@@ -78,44 +78,44 @@ ovsdb|WARN|schema: changed 2 columns in 'OVN_Southbound' database from ephemeral
join_cluster() {
local i=$1
- others=
- for j in `seq 1 $n`; do
- if test $i != $j; then
- others="$others unix:s$j.raft"
+ others=
+ for j in `seq 1 $n`; do
+ if test $i != $j; then
+ others="$others unix:s$j.raft"
fi
- done
- AT_CHECK([ovsdb-tool join-cluster s$i.db $schema unix:s$i.raft $others])
+ done
+ AT_CHECK([ovsdb-tool join-cluster s$i.db $schema unix:s$i.raft $others])
}
start_server() {
local i=$1
- printf "\ns$i: starting\n"
- AT_CHECK([ovsdb-server -vjsonrpc -vconsole:off -vsyslog:off --detach --no-chdir --log-file=s$i.log --pidfile=s$i.pid --unixctl=s$i --remote=punix:s$i.ovsdb s$i.db])
+ printf "\ns$i: starting\n"
+ AT_CHECK([ovsdb-server -vjsonrpc -vconsole:off -vsyslog:off --detach --no-chdir --log-file=s$i.log --pidfile=s$i.pid --unixctl=s$i --remote=punix:s$i.ovsdb s$i.db])
}
stop_server() {
local i=$1
- printf "\ns$i: stopping\n"
+ printf "\ns$i: stopping\n"
OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/s$i], [s$i.pid])
}
connect_server() {
local i=$1
- printf "\ns$i: waiting to connect to storage\n"
- AT_CHECK([ovsdb-client --timeout=30 -vfile -vsyslog:off -vvlog:off --log-file=connect$i.log wait unix:s$i.ovsdb $schema connected])
+ printf "\ns$i: waiting to connect to storage\n"
+ AT_CHECK([ovsdb-client --timeout=30 -vfile -vsyslog:off -vvlog:off --log-file=connect$i.log wait unix:s$i.ovsdb $schema connected])
}
remove_server() {
local i=$1
- printf "\ns$i: removing from cluster\n"
- AT_CHECK([ovs-appctl --timeout=30 -t "`pwd`"/s$i cluster/leave OVN_Southbound])
- printf "\ns$i: waiting for removal to complete\n"
- AT_CHECK([ovsdb-client --timeout=30 -vfile -vsyslog:off -vvlog:off --log-file=remove$i.log wait unix:s$i.ovsdb $schema removed])
- stop_server $victim
+ printf "\ns$i: removing from cluster\n"
+ AT_CHECK([ovs-appctl --timeout=30 -t "`pwd`"/s$i cluster/leave OVN_Southbound])
+ printf "\ns$i: waiting for removal to complete\n"
+ AT_CHECK([ovsdb-client --timeout=30 -vfile -vsyslog:off -vvlog:off --log-file=remove$i.log wait unix:s$i.ovsdb $schema removed])
+ stop_server $victim
}
add_server() {
local i=$1
- rm s$i.db
+ rm s$i.db
join_cluster $i
- start_server $i
- connect_server $i
+ start_server $i
+ connect_server $i
}
cid=`ovsdb-tool db-cid s1.db`
@@ -134,16 +134,16 @@ ovsdb|WARN|schema: changed 2 columns in 'OVN_Southbound' database from ephemeral
n1=10 n2=5
echo "starting $n1*$n2 ovn-sbctl processes..."
for i in $(seq 0 $(expr $n1 - 1) ); do
- (for j in $(seq $n2); do
+ (for j in $(seq $n2); do
: > $i-$j.running
- run_as "ovn-sbctl($i-$j)" ovn-sbctl "-vPATTERN:console:ovn-sbctl($i-$j)|%D{%H:%M:%S}|%05N|%c|%p|%m" --log-file=$i-$j.log -vfile -vsyslog:off -vtimeval:off --timeout=120 --no-leader-only add SB_Global . external_ids $i-$j=$i-$j
- status=$?
- if test $status != 0; then
- echo "$i-$j exited with status $status" > $i-$j:$status
+ run_as "ovn-sbctl($i-$j)" ovn-sbctl "-vPATTERN:console:ovn-sbctl($i-$j)|%D{%H:%M:%S}|%05N|%c|%p|%m" --log-file=$i-$j.log -vfile -vsyslog:off -vtimeval:off --timeout=120 --no-leader-only add SB_Global . external_ids $i-$j=$i-$j
+ status=$?
+ if test $status != 0; then
+ echo "$i-$j exited with status $status" > $i-$j:$status
fi
rm $i-$j.running
- done
- : > $i.done)&
+ done
+ : > $i.done)&
done
echo "...done"
sleep 2
@@ -153,44 +153,44 @@ ovsdb|WARN|schema: changed 2 columns in 'OVN_Southbound' database from ephemeral
i=0
(while :; do echo; sleep 1; done) | while read; do
printf "t=%2d s:" $i
- done=0
+ done=0
for j in $(seq 0 $(expr $n1 - 1)); do
- if test -f $j.done; then
- printf " $j"
- done=$(expr $done + 1)
+ if test -f $j.done; then
+ printf " $j"
+ done=$(expr $done + 1)
fi
- done
- printf '\n'
- if test $done = $n1; then
- break
+ done
+ printf '\n'
+ if test $done = $n1; then
+ break
fi
case $phase in # (
- 0)
+ 0)
if test $done -ge $(expr $n1 / 4); then
- if test $variant = kill; then
- stop_server $victim
- else
- remove_server $victim
- fi
- phase=1
- next=$(expr $i + 2)
+ if test $variant = kill; then
+ stop_server $victim
+ else
+ remove_server $victim
+ fi
+ phase=1
+ next=$(expr $i + 2)
fi
- ;; # (
+ ;; # (
1)
- if test $i -ge $next; then
- if test $variant = kill; then
- start_server $victim
- connect_server $victim
- else
- add_server $victim
- fi
- phase=2
- fi
- ;;
- esac
+ if test $i -ge $next; then
+ if test $variant = kill; then
+ start_server $victim
+ connect_server $victim
+ else
+ add_server $victim
+ fi
+ phase=2
+ fi
+ ;;
+ esac
- i=$(expr $i + 1)
+ i=$(expr $i + 1)
done
echo "...done"
AT_CHECK([if test $phase != 2; then exit 77; fi])
@@ -203,9 +203,9 @@ ovsdb|WARN|schema: changed 2 columns in 'OVN_Southbound' database from ephemeral
AT_CHECK([ovn-sbctl --timeout=30 --log-file=finalize.log -vtimeval:off -vfile -vsyslog:off --bare get SB_Global . external-ids | sed 's/, /\n/g; s/[[{}""]]//g;' | sort], [0], [expout])
for i in `seq $n`; do
- if test $i != $victim || test $phase != 1; then
- stop_server $i
- fi
+ if test $i != $victim || test $phase != 1; then
+ stop_server $i
+ fi
done
# We ignore stdout because non-fatal warnings get printed there.