jolly has uploaded this change for review.

View Change

RemSIM/server: Expand maintenance mapping test with timeout

Expand the previous test by adding a timeout. Instead of removing the
maintenance mapping via REST API, wait until timeout and expect the
mapping to be removed automatically.

Related: SYS#8159
Change-Id: Iab27eb51ef51fafc2cdef8aee7dc96892fb613fd
---
M remsim/RemsimServer_Tests.ttcn
1 file changed, 30 insertions(+), 5 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/39/43839/1
diff --git a/remsim/RemsimServer_Tests.ttcn b/remsim/RemsimServer_Tests.ttcn
index 5edee33..28f89b8 100644
--- a/remsim/RemsimServer_Tests.ttcn
+++ b/remsim/RemsimServer_Tests.ttcn
@@ -37,7 +37,8 @@
}

/* run a HTTP PUT to add a new slotmap to the remsim-server */
-function f_rsres_post_slotmap(JsSlotmap slotmap, template integer exp_sts := 201, boolean maintenance := false)
+function f_rsres_post_slotmap(JsSlotmap slotmap, template integer exp_sts := 201, boolean maintenance := false,
+ integer tiout := 0)
runs on http_CT return HTTPResponse {
var charstring body := oct2char(f_enc_JsSlotmap(slotmap));
var HTTPMessage http_resp;
@@ -45,6 +46,14 @@
if (maintenance) {
url := url & "?maintenance=true";
}
+ if (tiout > 0) {
+ if (maintenance) {
+ url := url & "&";
+ } else {
+ url := url & "?";
+ }
+ url := url & "timeout=" & int2str(tiout);
+ }
http_resp := f_http_transact(url := url, method := "POST", body := body, exp := tr_HTTP_Resp(exp_sts))
return http_resp.response;
}
@@ -672,7 +681,7 @@


/* Create a regular mapping between client and bank, then override it via maintenance mapping. */
-testcase TC_slotmap_switch_maintenance() runs on test_CT {
+function f_TC_slotmap_switch_maintenance(integer tiout := 0) runs on test_CT {
var ComponentIdentity rspro_id := valueof(ts_CompId(remsimBankd, testcasename()));
var BankSlot bslot := valueof(ts_BankSlot(1, 2));
var ClientSlot cslot1 := valueof(ts_ClientSlot(3, 4));
@@ -719,7 +728,7 @@
/* 2. Create mainenance mapping, while having a regular mapping. */

/* Create a new slotmap via HTTP. It uses the same bankd/slot */
- f_rsres_post_slotmap(sm2, maintenance := true);
+ f_rsres_post_slotmap(sm2, maintenance := true, tiout := tiout);

/* Expect the slotmap to be removed from bank. */
as_rspro_remove_mapping(0, sm1.client, sm1.bank);
@@ -744,8 +753,13 @@

/* 3. Delete mainenance mapping while still having regular mapping. */

- /* Delete the maintenance slotmap via REST. */
- f_rsres_delete_slotmap(sm2.bank, maintenance := true);
+ if (tiout == 0) {
+ /* Delete the maintenance slotmap via REST. */
+ f_rsres_delete_slotmap(sm2.bank, maintenance := true);
+ } else {
+ log("Waiting for mapping to time out...");
+ f_sleep(int2float(tiout + 2));
+ }

/* Expect the maintenance slotmap to be removed from bank. */
as_rspro_remove_mapping(0, sm2.client, sm2.bank);
@@ -783,6 +797,16 @@
as_rspro_cfg_client_bank(1, ?, tr_IpPort(ts_IPv4("0.0.0.0"), 0));
}

+/* Create a regular mapping between client and bank, then override it via maintenance mapping. */
+testcase TC_slotmap_switch_maintenance() runs on test_CT {
+ f_TC_slotmap_switch_maintenance();
+}
+
+/* Same as above, but use timeout rather than delete command via rest API to remove maintenance mapping. */
+testcase TC_slotmap_switch_maintenance_timeout() runs on test_CT {
+ f_TC_slotmap_switch_maintenance(tiout := 10);
+}
+



@@ -813,6 +837,7 @@
execute( TC_slotmap_del_active_client() );
execute( TC_slotmap_add_active_bank() );
execute( TC_slotmap_switch_maintenance() );
+ execute( TC_slotmap_switch_maintenance_timeout() );
}



To view, visit change 43839. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iab27eb51ef51fafc2cdef8aee7dc96892fb613fd
Gerrit-Change-Number: 43839
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas@eversberg.eu>