[Asterisk-code-review] pjsip: Improve RLS test stability. (testsuite[16.0])
Jenkins2
asteriskteam at digium.com
Tue Oct 2 07:21:24 CDT 2018
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/10356 )
Change subject: pjsip: Improve RLS test stability.
......................................................................
pjsip: Improve RLS test stability.
The mechanism used for TLS testing has the ability to execute AMI
actions on a time basis (specifically every 2 seconds). This caused
a problem with tests as Asterisk would take some time to start and
the SUBSCRIBE would take some time. This would result in the initial
NOTIFY being different than the expected value.
This change adds the ability to execute an AMI action after receiving
an RLS NOTIFY which makes the result more predictable and the tests
more stable.
Change-Id: I900448aec7aa23012566e41cd15dadf969c004bc
---
M tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml
M tests/channels/pjsip/subscriptions/rls/rls_test.py
13 files changed, 21 insertions(+), 40 deletions(-)
Approvals:
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml
index 98437ce..b5f02a5 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml
@@ -47,9 +47,7 @@
-
full-state: True
resources: { 'alice': {'type': 'MWI', 'state': 'active', 'voice_message': '0/0 (0/0)', 'messages_waiting': 'no'}, 'bob': {'type': 'MWI', 'state': 'active', 'voice_message': '0/0 (0/0)', 'messages_waiting': 'no'} }
+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
-
full-state: True
resources: { 'alice': {'type': 'MWI', 'state': 'active', 'voice_message': '1/2 (0/0)', 'messages_waiting': 'yes'}, 'bob': {'type': 'MWI', 'state': 'active', 'voice_message': '0/0 (0/0)', 'messages_waiting': 'no'} }
- ami-action:
- -
- { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml
index 7d20062..3d806b4 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml
@@ -60,6 +60,7 @@
'messages_waiting': 'no'
}
}
+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
-
full-state: False
resources: {
@@ -70,6 +71,3 @@
'messages_waiting': 'yes'
}
}
- ami-action:
- -
- { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
index 9cfbedd..423dc61 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
@@ -45,9 +45,7 @@
-
full-state: True
resources: { 'alice': {'type': 'PIDF', 'state': 'active'}, 'bob': {'type': 'PIDF', 'state': 'active'} }
+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
-
full-state: True
resources: { 'alice': {'type': 'PIDF', 'state': 'active'}, 'bob': {'type': 'PIDF', 'state': 'active'} }
- ami-action:
- -
- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml
index 2c731d6..4aa4926 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml
@@ -46,9 +46,7 @@
-
full-state: True
resources: { 'alice': {'type': 'PIDF', 'state': 'active'}, 'bob': {'type': 'PIDF', 'state': 'active'} }
+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
-
full-state: False
resources: { 'alice': {'type': 'PIDF', 'state': 'active' } }
- ami-action:
- -
- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml
index 9d8f103..e51329a 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml
@@ -72,6 +72,7 @@
'messages_waiting': 'no'
}
}
+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
-
full-state: True
resources: {
@@ -100,7 +101,3 @@
'messages_waiting': 'no'
}
}
-
- ami-action:
- -
- { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml
index 98c32b2..baf64f6 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml
@@ -72,6 +72,7 @@
'messages_waiting': 'no'
}
}
+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'carol at default', 'NewMessages': '1', 'OldMessages': '2' }
-
full-state: True
resources: {
@@ -100,7 +101,3 @@
'messages_waiting': 'yes'
}
}
-
- ami-action:
- -
- { 'action': 'MWIUpdate', 'Mailbox': 'carol at default', 'NewMessages': '1', 'OldMessages': '2' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml
index e691771..3f5d5f6 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml
@@ -72,6 +72,7 @@
'messages_waiting': 'no'
}
}
+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
-
full-state: False
resources: {
@@ -88,7 +89,3 @@
}
}
}
-
- ami-action:
- -
- { 'action': 'MWIUpdate', 'Mailbox': 'alice at default', 'NewMessages': '1', 'OldMessages': '2' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml
index a17bb80..7d4e173 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml
@@ -72,6 +72,7 @@
'messages_waiting': 'no'
}
}
+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'carol at default', 'NewMessages': '1', 'OldMessages': '2' }
-
full-state: False
resources: {
@@ -82,7 +83,3 @@
'messages_waiting': 'yes'
}
}
-
- ami-action:
- -
- { 'action': 'MWIUpdate', 'Mailbox': 'carol at default', 'NewMessages': '1', 'OldMessages': '2' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml
index f32e773..effdbae 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml
@@ -53,6 +53,7 @@
},
'carol': {'type': 'PIDF', 'state': 'active'}
}
+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
-
full-state: True
resources: {
@@ -64,6 +65,3 @@
},
'carol': {'type': 'PIDF', 'state': 'active'}
}
- ami-action:
- -
- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml
index 13f40d6..33213ec 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml
@@ -53,6 +53,7 @@
},
'carol': {'type': 'PIDF', 'state': 'active'}
}
+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }
-
full-state: True
resources: {
@@ -64,6 +65,3 @@
},
'carol': {'type': 'PIDF', 'state': 'active'}
}
- ami-action:
- -
- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml
index c9eb022..812e937 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml
@@ -54,6 +54,7 @@
},
'carol': {'type': 'PIDF', 'state': 'active'}
}
+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
-
full-state: False
resources: {
@@ -63,6 +64,3 @@
}
}
}
- ami-action:
- -
- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }
diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml
index e5917b0..25d8b15 100644
--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml
@@ -54,11 +54,9 @@
},
'carol': {'type': 'PIDF', 'state': 'active'}
}
+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }
-
full-state: False
resources: {
'carol': {'type': 'PIDF', 'state': 'active'}
}
- ami-action:
- -
- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }
diff --git a/tests/channels/pjsip/subscriptions/rls/rls_test.py b/tests/channels/pjsip/subscriptions/rls/rls_test.py
index 08d0567..732a77f 100644
--- a/tests/channels/pjsip/subscriptions/rls/rls_test.py
+++ b/tests/channels/pjsip/subscriptions/rls/rls_test.py
@@ -217,6 +217,15 @@
info_msg = "Resource ({0}) validated successfully."
LOGGER.info(info_msg.format(self.packets_idx))
+
+ try:
+ action = self.packets[self.packets_idx]["ami-action"]
+ debug_msg = "Sending AMI action: {0}"
+ LOGGER.debug(debug_msg.format(action))
+ self.ami.sendMessage(action)
+ except KeyError:
+ pass
+
self.packets_idx += 1
if self.packets_idx == len(self.packets):
--
To view, visit https://gerrit.asterisk.org/10356
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 16.0
Gerrit-MessageType: merged
Gerrit-Change-Id: I900448aec7aa23012566e41cd15dadf969c004bc
Gerrit-Change-Number: 10356
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181002/c6aa9e17/attachment-0001.html>
More information about the asterisk-code-review
mailing list