def testGetLogForTheSameStepFromBuildNotIsolated(self, _): master_name = 'm' builder_name = 'b' build_number = 121 step_name = 'atest' self.assertIsNone( ci_test_failure._GetTestLevelLogForAStep(master_name, builder_name, build_number, step_name, None))
def testGetLogForTheSameStepFromBuildNotNotJsonLoadable(self): master_name = 'm' builder_name = 'b' build_number = 121 step_name = 'atest' step = WfStep.Create(master_name, builder_name, build_number, step_name) step.isolated = True step.log_data = 'log' step.put() self.assertIsNone( ci_test_failure._GetTestLevelLogForAStep(master_name, builder_name, build_number, step_name, None))
def testGetLogForTheSameStepFromBuildReslutLogInvalid( self, mock_isolated_data, _): master_name = 'm' builder_name = 'b' build_number = 121 step_name = 'atest' mock_isolated_data.return_value = [{ 'isolatedserver': 'https://isolateserver.appspot.com', 'namespace': { 'namespace': 'default-gzip' }, 'digest': 'isolatedhashabctest' }] self.assertIsNone( ci_test_failure._GetTestLevelLogForAStep(master_name, builder_name, build_number, step_name, None))
def testGetLogForTheSameStepFromBuild(self, mock_step_log, mock_isolated_data): master_name = 'm' builder_name = 'b' build_number = 222 step_name = 'abc_test' mock_isolated_data.return_value = [{ 'isolatedserver': 'https://isolateserver.appspot.com', 'namespace': { 'namespace': 'default-gzip' }, 'digest': 'isolatedhashabctest' }] mock_step_log.return_value = { 'disabled_tests': [], 'global_tags': [], 'all_tests': [ 'Unittest1.Subtest1', 'Unittest1.Subtest2', 'Unittest2.Subtest1', 'Unittest2.Subtest2', 'Unittest3.Subtest1', 'Unittest3.Subtest2', 'Unittest3.Subtest3' ], 'per_iteration_data': [{ 'Unittest2.Subtest1': [{ 'elapsed_time_ms': 56, 'losless_snippet': True, 'output_snippet': ('ERROR:x_test.cc:1234\\na/b/u2s1.cc' ':567: Failure\\n'), 'status': 'FAILURE', 'output_snippet_base64': ('RVJST1I6eF90ZXN0LmNjOjEyMzRcbmEvYi91MnMxLmNj' 'OjU2NzogRmFpbHVyZVxu') }], 'Unittest3.Subtest2': [{ 'elapsed_time_ms': 80, 'losless_snippet': True, 'output_snippet': 'a/b/u3s2.cc:110: Failure\\n', 'status': 'FAILURE', 'output_snippet_base64': 'YS9iL3UzczIuY2M6MTEwOiBGYWlsdXJlXG4=' }] }] } expected_failure_log = { 'Unittest2.Subtest1': ('RVJST1I6eF90ZXN0LmNjOjEyMzRcbmEvYi91MnMxLmNjOjU2NzogRmFpbHVyZVxu' ), 'Unittest3.Subtest2': 'YS9iL3UzczIuY2M6MTEwOiBGYWlsdXJlXG4=' } failure_log = ci_test_failure._GetTestLevelLogForAStep( master_name, builder_name, build_number, step_name, None) self.assertEqual(failure_log, expected_failure_log)