Changeset bd1e5e5 in nscp for scripts/python/test_nsca.py
- Timestamp:
- 01/20/12 07:54:34 (16 months ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2
- Children:
- 6fbb689
- Parents:
- b175d61
- File:
-
- 1 edited
-
scripts/python/test_nsca.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
scripts/python/test_nsca.py
rb175d61 rbd1e5e5 43 43 #self.uuid = unicodedata.normalize('NFKD', command).encode('ascii','ignore') 44 44 self.command = command 45 self.uuid = None46 45 self.source = None 47 46 self.status = None … … 89 88 def set_response(self, msg): 90 89 with sync: 90 if msg.uuid in self._responses: 91 log('Updated: %s'%msg.uuid) 91 92 self._responses[msg.uuid].copy_changed_attributes(msg) 93 else: 94 log('Added: %s'%msg.uuid) 95 self._responses[msg.uuid] = msg 96 92 97 93 98 def del_response(self, id): … … 120 125 def simple_inbox_handler_wrapped(self, channel, source, command, status, message, perf): 121 126 log('Got simple message %s on %s'%(command, channel)) 122 msg = self.get_response(command)127 msg = NSCAMessage(command) 123 128 msg.source = source 124 129 msg.status = status … … 135 140 log('Got message %s on %s'%(command, channel)) 136 141 137 msg = self.get_response(command)142 msg = NSCAMessage(command) 138 143 msg.got_response = True 139 144 self.set_response(msg) … … 148 153 if self.has_response(uuid): 149 154 rmsg = self.get_response(uuid) 155 if not rmsg.got_simple_response or not rmsg.got_response: 156 for j in range(0,3): 157 rmsg = self.get_response(uuid) 158 if rmsg.got_simple_response and rmsg.got_response: 159 log('Got delayed response %s'%uuid) 160 else: 161 log('Waiting for delayed response %s (%d/10)'%(uuid, j+1)) 162 150 163 result.add_message(rmsg.got_response, 'Testing to recieve message using %s'%tag) 151 if 'exec' in tag and 'UNKNOWN' in tag and not rmsg.got_simple_response:152 result.add_message(True, 'FAILED -- TODO -- FIX ME -- Testing to recieve simple message using %s'%tag)153 else:154 164 result.add_message(rmsg.got_simple_response, 'Testing to recieve simple message using %s'%tag) 155 #result.assert_equals(rmsg.last_source, source, 'Verify that source is sent through')156 165 result.assert_equals(rmsg.command, uuid, 'Verify that command is sent through using %s'%tag) 157 166 result.assert_contains(rmsg.message, msg, 'Verify that message is sent through using %s'%tag) 158 result.assert_equals(rmsg.perfdata, perf, 'Verify that performance data is sent through using %s'%tag) 167 168 #result.assert_equals(rmsg.last_source, source, 'Verify that source is sent through') 169 #result.assert_equals(rmsg.perfdata, perf, 'Verify that performance data is sent through using %s'%tag) 159 170 self.del_response(uuid) 160 171 return True … … 190 201 (result_code, err) = core.submit('nsca_test_outbox', message.SerializeToString()) 191 202 192 result = TestResult('Testing payload : %s'%tag)203 result = TestResult('Testing payload submission (via API): %s'%tag) 193 204 result.add_message(len(err) == 0, 'Testing to send message using %s/sbp'%tag, err) 194 205 self.wait_and_validate(uid, result, msg, perf, '%s/spb'%tag) … … 208 219 ] 209 220 (result_code, result_message) = core.simple_exec('any', 'nsca_submit', args) 210 result = TestResult( )221 result = TestResult('Testing payload submission (via command line exec): %s'%tag) 211 222 212 223 result.add_message(result_code == 0, 'Testing to send message using %s/exec:1'%tag)
Note: See TracChangeset
for help on using the changeset viewer.








