Signed-off-by: Jan Tluka jtluka@redhat.com --- regression-tests/tests/27/desc | 10 ++++++++ regression-tests/tests/27/recipe1.xml | 32 +++++++++++++++++++++++ regression-tests/tests/27/recipe2.xml | 32 +++++++++++++++++++++++ regression-tests/tests/27/recipe3.xml | 31 ++++++++++++++++++++++ regression-tests/tests/27/recipe4.xml | 31 ++++++++++++++++++++++ regression-tests/tests/27/recipe5.xml | 32 +++++++++++++++++++++++ regression-tests/tests/27/recipe6.xml | 30 ++++++++++++++++++++++ regression-tests/tests/27/recipe7.xml | 30 ++++++++++++++++++++++ regression-tests/tests/27/recipe8.xml | 32 +++++++++++++++++++++++ regression-tests/tests/27/run.sh | 48 +++++++++++++++++++++++++++++++++++ 10 files changed, 308 insertions(+) create mode 100644 regression-tests/tests/27/desc create mode 100644 regression-tests/tests/27/recipe1.xml create mode 100644 regression-tests/tests/27/recipe2.xml create mode 100644 regression-tests/tests/27/recipe3.xml create mode 100644 regression-tests/tests/27/recipe4.xml create mode 100644 regression-tests/tests/27/recipe5.xml create mode 100644 regression-tests/tests/27/recipe6.xml create mode 100644 regression-tests/tests/27/recipe7.xml create mode 100644 regression-tests/tests/27/recipe8.xml create mode 100755 regression-tests/tests/27/run.sh
diff --git a/regression-tests/tests/27/desc b/regression-tests/tests/27/desc new file mode 100644 index 0000000..fb66011 --- /dev/null +++ b/regression-tests/tests/27/desc @@ -0,0 +1,10 @@ +Check timeout handling for commands run in background and foreground. + +1. put a command on bg and intr() it before desired timeout +2. put a command on bg and intr() it after desired timeout +3. put a command on bg and immediately wait for it's completion before timeout +4. put a command on bg and immediately wait for it's completion after timeout +5. put a command on bg and wait for it not earlier after it's completed +6. put a command on fg and set timeout longer than expected completion +7. put a command on fg and set timeout shorter than expected completion + diff --git a/regression-tests/tests/27/recipe1.xml b/regression-tests/tests/27/recipe1.xml new file mode 100644 index 0000000..56b1ff6 --- /dev/null +++ b/regression-tests/tests/27/recipe1.xml @@ -0,0 +1,32 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 10" host="testmachine1" bg_id="1" timeout="15"/> + <ctl_wait seconds="2"/> + <intr host="testmachine1" bg_id="1"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/recipe2.xml b/regression-tests/tests/27/recipe2.xml new file mode 100644 index 0000000..c7a60dc --- /dev/null +++ b/regression-tests/tests/27/recipe2.xml @@ -0,0 +1,32 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 5" host="testmachine1" bg_id="2" timeout="5"/> + <ctl_wait seconds="7"/> + <intr host="testmachine1" bg_id="2"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/recipe3.xml b/regression-tests/tests/27/recipe3.xml new file mode 100644 index 0000000..83510a1 --- /dev/null +++ b/regression-tests/tests/27/recipe3.xml @@ -0,0 +1,31 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 5" host="testmachine1" bg_id="3" timeout="3"/> + <wait host="testmachine1" bg_id="3"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/recipe4.xml b/regression-tests/tests/27/recipe4.xml new file mode 100644 index 0000000..b9f1fe2 --- /dev/null +++ b/regression-tests/tests/27/recipe4.xml @@ -0,0 +1,31 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 5" host="testmachine1" bg_id="4" timeout="7"/> + <wait host="testmachine1" bg_id="4"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/recipe5.xml b/regression-tests/tests/27/recipe5.xml new file mode 100644 index 0000000..f7ac10c --- /dev/null +++ b/regression-tests/tests/27/recipe5.xml @@ -0,0 +1,32 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 10" host="testmachine1" bg_id="1"/> + <ctl_wait seconds="15"/> + <wait host="testmachine1" bg_id="1"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/recipe6.xml b/regression-tests/tests/27/recipe6.xml new file mode 100644 index 0000000..0dac603 --- /dev/null +++ b/regression-tests/tests/27/recipe6.xml @@ -0,0 +1,30 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 5" host="testmachine1" timeout="10"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/recipe7.xml b/regression-tests/tests/27/recipe7.xml new file mode 100644 index 0000000..bcc8c2c --- /dev/null +++ b/regression-tests/tests/27/recipe7.xml @@ -0,0 +1,30 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 5" host="testmachine1" timeout="3"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/recipe8.xml b/regression-tests/tests/27/recipe8.xml new file mode 100644 index 0000000..9809b17 --- /dev/null +++ b/regression-tests/tests/27/recipe8.xml @@ -0,0 +1,32 @@ +<lnstrecipe> + <network> + <host id="testmachine1"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.2/24</address> + <address>fe01::1/64</address> + </addresses> + </eth> + </interfaces> + </host> + <host id="testmachine2"> + <params/> + <interfaces> + <eth id="phy1" label="testnet"> + <addresses> + <address>192.168.100.3/24</address> + <address>fe01::2/64</address> + </addresses> + </eth> + </interfaces> + </host> + </network> + + <task> + <run command="sleep 10" host="testmachine1" bg_id="1"/> + <ctl_wait seconds="2"/> + <intr host="testmachine1" bg_id="1"/> + </task> +</lnstrecipe> diff --git a/regression-tests/tests/27/run.sh b/regression-tests/tests/27/run.sh new file mode 100755 index 0000000..e61da3f --- /dev/null +++ b/regression-tests/tests/27/run.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +. ../lib.sh + +init_test + +lnst-ctl -d run recipe1.xml | tee test.log +rv1=${PIPESTATUS[0]} +log1=`cat test.log` + +lnst-ctl -d run recipe2.xml | tee test.log +rv2=${PIPESTATUS[0]} +log2=`cat test.log` + +lnst-ctl -d run recipe3.xml | tee test.log +rv3=${PIPESTATUS[0]} +log3=`cat test.log` + +lnst-ctl -d run recipe4.xml | tee test.log +rv4=${PIPESTATUS[0]} +log4=`cat test.log` + +lnst-ctl -d run recipe5.xml | tee test.log +rv5=${PIPESTATUS[0]} +log5=`cat test.log` + +lnst-ctl -d run recipe6.xml | tee test.log +rv6=${PIPESTATUS[0]} +log6=`cat test.log` + +lnst-ctl -d run recipe7.xml | tee test.log +rv7=${PIPESTATUS[0]} +log7=`cat test.log` + +print_separator +assert_status "pass" "$rv1" +assert_status "pass" "$rv2" +assert_status "fail" "$rv3" +assert_log "INFO" "RPC connection to machine testmachine1 timed out" "$log3" +assert_status "pass" "$rv4" +assert_status "pass" "$rv5" +assert_status "pass" "$rv6" +assert_status "fail" "$rv7" +assert_log "INFO" "RPC connection to machine testmachine1 timed out" "$log7" + +rm -f test.log + +end_test