Created
June 13, 2012 16:34
-
-
Save eigenhombre/2925162 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TestHardPDAQCrash(TestLiveControlWithPDAQ): | |
| def test(self): | |
| assert 'OK' == livecmd("config set -i nice_default_config") | |
| assert 'OK' == livecmd("altconfigs add -i alt1") | |
| assert 'OK' == livecmd("start daq") | |
| # Simulate hard crash of pDAQ: | |
| self.toy.close() | |
| # Lexical closure to collect complete set of log messages: | |
| def message_updater(): | |
| msgs = [] | |
| def update_msgs(): | |
| msgs.extend(drain_queue(self.sink)) | |
| def messages_received_so_far(): | |
| update_msgs() | |
| return msgs | |
| return messages_received_so_far | |
| allmsgs = message_updater() | |
| def correct_recovery_failure_messages_generated(): | |
| all = allmsgs() | |
| moni = [x["payload"] for x in all if x["cmd"] == "moni"] | |
| logs = [x["value"] for x in moni if x["varname"] == "log"] | |
| recovery_fail_msgs = filter( | |
| lambda x: "failed and did not generate any events" in x, | |
| logs) | |
| return len(recovery_fail_msgs) == 8 | |
| misc.wait_until(correct_recovery_failure_messages_generated) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment