def test_collect_nothing(self): self.mock(swarming, 'get_task_keys', lambda *_: ['task_key']) self.mock(swarming, 'yield_results', lambda *_: []) self.assertEqual( 1, swarming.collect('url', 'name', 2, 'timeout', 'decorate', True, None)) self._check_output('', 'Results from some shards are missing: 0, 1\n')
def collect(url, task_ids): """Simplifies the call to swarming.collect().""" return swarming.collect(swarming=url, task_ids=task_ids, timeout=10, decorate=True, print_status_updates=True, task_summary_json=None, task_output_dir=None)
def collect(url, task_ids): """Simplifies the call to swarming.collect().""" return swarming.collect( swarming=url, task_ids=task_ids, timeout=10, decorate=True, print_status_updates=True, task_summary_json=None, task_output_dir=None)
def test_collect_fail(self): self.mock(swarming, 'get_test_keys', lambda *_: [1, 2]) self.mock(sys, 'stdout', StringIO.StringIO()) data = { 'config_instance_index': 0, 'exit_codes': '0,8', 'machine_id': 0, 'output': 'Foo', } self.mock(swarming, 'yield_results', lambda *_: [(0, data)]) self.assertEquals( 8, swarming.collect('url', 'test_name', 'timeout', 'decorate'))
def test_collect_one_missing(self): self.mock(swarming, "get_task_keys", lambda *_: [1, 2]) data = {"config_instance_index": 0, "exit_codes": "0", "machine_id": 0, "output": "Foo"} self.mock(swarming, "yield_results", lambda *_: [(0, data)]) self.assertEqual(1, swarming.collect("url", "test_name", "timeout", "decorate", True, None)) self._check_output( "\n================================================================\n" "Begin output from shard index 0 (machine tag: 0, id: unknown)\n" "================================================================\n\n" "Foo================================================================\n" "End output from shard index 0 (machine tag: 0, id: unknown). Return 0" "\n" "================================================================\n\n", "Results from some shards are missing: 1\n", )
def test_collect_fail(self): self.mock(swarming, 'get_task_keys', lambda *_: [1, 2]) data = { 'config_instance_index': 0, 'exit_codes': '0,8', 'machine_id': 0, 'output': 'Foo', } self.mock(swarming, 'yield_results', lambda *_: [(0, data)]) self.assertEqual( 8, swarming.collect('url', 'test_name', 'timeout', 'decorate')) self._check_output( '\n================================================================\n' 'Begin output from shard index 0 (machine tag: 0, id: unknown)\n' '================================================================\n\n' 'Foo================================================================\n' 'End output from shard index 0 (machine tag: 0, id: unknown). Return 8' '\n' '================================================================\n\n', '')
def test_collect_one_missing(self): self.mock(swarming, 'get_task_keys', lambda *_: ['task_key']) data = { 'config_instance_index': 0, 'exit_codes': '0', 'machine_id': 0, 'output': 'Foo\n', } self.mock(swarming, 'yield_results', lambda *_: [(0, data)]) self.assertEqual( 1, swarming.collect('url', 'name', 2, 'timeout', 'decorate', True, None)) self._check_output( '\n================================================================\n' 'Begin output from shard index 0 (machine tag: 0, id: unknown)\n' '================================================================\n\n' 'Foo\n' '================================================================\n' 'End output from shard index 0 (machine tag: 0, id: unknown).\n' 'Exit code 0 (0x0).\n' '================================================================\n\n', 'Results from some shards are missing: 1\n')
def test_collect_negative_exit_code(self): self.mock(swarming, 'get_task_keys', lambda *_: ['task_key']) data = { 'config_instance_index': 0, 'exit_codes': '-1073741515,0', 'machine_id': 0, 'output': 'Foo\n', } self.mock(swarming, 'yield_results', lambda *_: [(0, data)]) self.assertEqual( 1, swarming.collect('url', 'name', 1, 'timeout', 'decorate', True, None)) self._check_output( '\n================================================================\n' 'Begin output from shard index 0 (machine tag: 0, id: unknown)\n' '================================================================\n\n' 'Foo\n' '================================================================\n' 'End output from shard index 0 (machine tag: 0, id: unknown).\n' 'Exit code -1073741515 (0xc0000135).\n' '================================================================\n\n', '')
def test_collect_nothing(self): self.mock(swarming, 'get_task_keys', lambda *_: [1, 2]) self.mock(swarming, 'yield_results', lambda *_: []) self.assertEqual( 1, swarming.collect('url', 'test_name', 'timeout', 'decorate'))
def test_collect_nothing(self): self.mock(swarming, 'get_test_keys', lambda *_: [1, 2]) self.mock(swarming, 'yield_results', lambda *_: []) self.assertEquals( 1, swarming.collect('url', 'test_name', 'timeout', 'decorate'))
def test_collect_nothing(self): self.mock(swarming, "get_task_keys", lambda *_: [1, 2]) self.mock(swarming, "yield_results", lambda *_: []) self.assertEqual(1, swarming.collect("url", "test_name", "timeout", "decorate", True, None)) self._check_output("", "Results from some shards are missing: 0, 1\n")