laforge submitted this change.

View Change



3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified
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, 26 insertions(+), 5 deletions(-)

diff --git a/remsim/RemsimServer_Tests.ttcn b/remsim/RemsimServer_Tests.ttcn
index 22a8c31..8e1ea55 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, integer priority := 0)
+function f_rsres_post_slotmap(JsSlotmap slotmap, template integer exp_sts := 201, integer priority := 0,
+ 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 (priority != 0) {
url := url & "?priority=" & int2str(priority);
}
+ if (tiout > 0) {
+ if (priority != 0) {
+ 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 priority mapping. */
-function f_TC_slotmap_switch_priority_mapping() runs on test_CT {
+function f_TC_slotmap_switch_priority_mapping(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 higher priority mapping, while having a regular mapping. */

/* Create a new slotmap via HTTP. It uses the same bankd/slot */
- f_rsres_post_slotmap(sm2, priority := 1);
+ f_rsres_post_slotmap(sm2, priority := 1, 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 higher priority mapping while still having regular mapping. */

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

/* Expect the higher piority slotmap to be removed from bank. */
as_rspro_remove_mapping(0, sm2.client, sm2.bank);
@@ -788,6 +802,12 @@
f_TC_slotmap_switch_priority_mapping();
}

+/* Same as above, but use timeout rather than delete command via rest API to remove higher piority mapping. */
+testcase TC_slotmap_switch_priority_mapping_timeout() runs on test_CT {
+ f_TC_slotmap_switch_priority_mapping(tiout := 2);
+}
+
+


/* TODO
@@ -817,6 +837,7 @@
execute( TC_slotmap_del_active_client() );
execute( TC_slotmap_add_active_bank() );
execute( TC_slotmap_switch_priority_mapping() );
+ execute( TC_slotmap_switch_priority_mapping_timeout() );
}

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

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iab27eb51ef51fafc2cdef8aee7dc96892fb613fd
Gerrit-Change-Number: 43839
Gerrit-PatchSet: 5
Gerrit-Owner: jolly <andreas@eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>