[asterisk-commits] tests/apps/mixmonitor: Fix sporadic test failures. (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 25 15:17:29 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: tests/apps/mixmonitor: Fix sporadic test failures.
......................................................................
tests/apps/mixmonitor: Fix sporadic test failures.
The tests/app/mixmonitor test executes MixMonitor on
some channels and then checks the resulting file size to
ensure they are within tolerance. This fails sometimes.
After looking at the output and the test there is a race
condition where the check occurs before the MixMonitor
thread has ended and finished writing out the file,
causing the file to be incomplete and the test to fail.
The test now waits for the 3 expected AMI events indicating
the MixMonitor thread has ended before checking the size of
the recorded files.
ASTERISK-25958 #close
Change-Id: I0b87c02b5728615755cd15a551f1cb8e40e4ad17
---
M tests/apps/mixmonitor/run-test
1 file changed, 13 insertions(+), 4 deletions(-)
Approvals:
Mark Michelson: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/tests/apps/mixmonitor/run-test b/tests/apps/mixmonitor/run-test
index 784bd9b..27995f7 100755
--- a/tests/apps/mixmonitor/run-test
+++ b/tests/apps/mixmonitor/run-test
@@ -27,7 +27,8 @@
def __init__(self):
super(MixMonitorTest, self).__init__()
- self.passed = False
+ # How many MixMonitor instances have ended, all 3 must end before checking file sizes
+ self.mixmonitor_ended = 0
# playback file is 2559 bytes of ulaw,
# that will come out to be ~41118 of wav
@@ -65,7 +66,16 @@
LOGGER.error(name + " size is not within the size tolerance.")
self.passed = False
- def read_result(self):
+ def state_mixmonitor_end(self, ami, event):
+ if event.get("state") != "MIXMONITOR_END":
+ return
+
+ self.mixmonitor_ended += 1
+
+ if self.mixmonitor_ended != 3:
+ LOGGER.info("All MixMonitor applications have not yet ended.")
+ return
+
self.passed = True
self.stop_reactor()
LOGGER.info("Checking MixMonitor recorded files...")
@@ -120,11 +130,10 @@
self.stop_reactor()
return
- self.read_result()
-
def ami_connect(self, ami):
self.ami = ami
self.ami.registerEvent("UserEvent", self.check_test1)
+ self.ami.registerEvent("TestEvent", self.state_mixmonitor_end)
self.ami.setVar(channel="", variable="TESTAUDIO1", value=self.audiofile1)
self.ami.setVar(channel="", variable="TESTAUDIO2", value=self.audiofile2)
--
To view, visit https://gerrit.asterisk.org/2697
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0b87c02b5728615755cd15a551f1cb8e40e4ad17
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-commits
mailing list