[expect] refactor common functions (#5634)

* unify node creating and destroying
* simplify switching between nodes
This commit is contained in:
Yakun Xu
2020-10-12 08:21:48 -07:00
committed by GitHub
parent c8ba04702c
commit 9e3b450218
42 changed files with 196 additions and 201 deletions
+3 -11
View File
@@ -30,8 +30,7 @@
source "tests/scripts/expect/_common.exp"
set max_node 15
set spawn_ids(1) [spawn_node 1]
set spawn_id $spawn_ids(1)
spawn_node 1
expect_after {
timeout { exit 1 }
}
@@ -45,8 +44,7 @@ wait_for "state" "leader"
expect "Done"
for {set i 2} {$i <= $max_node} {incr i} {
set spawn_ids($i) [spawn_node $i]
set spawn_id $spawn_ids($i)
spawn_node $i
expect_after {
timeout { exit 1 }
}
@@ -69,10 +67,4 @@ expect_after {
send "child table\n"
expect "Done"
for {set i 1} {$i <= $max_node} {incr i} {
set spawn_id $spawn_ids($i)
expect_after {
timeout { exit 1 }
}
dispose
}
dispose_all