def test_bail_out_fixed(self): """Test bailing out when the testcase is fixed.""" self.testcase.fixed = 'Yes' self.testcase.is_impact_set_flag = True self.testcase.put() impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged()
def test_non_prod_build(self): """Test getting impact for non-prod build.""" self.mock.has_production_builds.return_value = False impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_changed() self.mock.get_impacts_from_url.assert_has_calls( [mock.call(self.testcase.regression, self.testcase.job_type)])
def test_bail_out_unreproducible(self): """Test bailing out when the testcase is unreproducible (reproduced once, but flaky).""" self.testcase.one_time_crasher_flag = True self.testcase.put() impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged()
def test_bail_out_status_unreproducible(self): """Test bailing out when the testcase status is unreproducible (never reproduced).""" self.testcase.status = 'Unreproducible' self.testcase.is_impact_set_flag = True self.testcase.put() impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged()
def test_prod_build(self): """Test getting impact for prod build.""" impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_changed() self.assertIn(data_types.TaskState.FINISHED, self.testcase.comments) self.assertNotIn('trace-stable', self.testcase.crash_stacktrace) self.assertNotIn('trace-beta', self.testcase.crash_stacktrace) self.mock.get_impacts_on_prod_builds.assert_has_calls( [mock.call(mock.ANY, 'path')])
def test_bail_out_non_prod_build_and_no_regression_range(self): """Test bailing out when reproducible testcase does not have a regression range yet and we dont have production builds to test.""" self.testcase.one_time_crasher_flag = False self.testcase.regression = '' self.testcase.put() self.mock.has_production_builds.return_value = False impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged()
def test_build_failed_exception(self): """Test when BuildFailedException occurs.""" self.mock.get_impacts_on_prod_builds.side_effect = ( impact_task.BuildFailedException('error-from-build')) impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged() self.assertIn('error-from-build', self.testcase.comments) self.assertIn(data_types.TaskState.ERROR, self.testcase.comments) self.mock.add_task.assert_has_calls([ mock.call('impact', self.testcase.key.id(), 'job', wait_time=None) ])
def test_bail_out_non_chromium(self): """Test bailing out for non chromium projects.""" self.mock.is_chromium.return_value = False impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged()
def test_bail_out_setup_testcase(self): """Test bailing out when setting up testcase fails.""" self.mock.has_production_builds.return_value = True self.mock.setup_testcase.return_value = ([], None, 'path') impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged()
def test_bail_out_custom_binary(self): """Test bailing out for custom binary.""" self.mock.is_custom_binary.return_value = True impact_task.execute_task(self.testcase.key.id(), 'job') self.expect_unchanged()