def testComplexRemoteTryjob(self): """Test option verification with complex mix of options.""" self.SetupCommandMock([ '--swarming', '--yes', '--latest-toolchain', '--nochromesdk', '--hwtest', '--notests', '--novmtests', '--noimagetests', '--timeout', '5', '--sanity-check-build', '--gerrit-patches', '123', '-g', '*123', '-g', '123..456', '--chrome_version', 'chrome_git_hash', '--committer-email', 'foo@bar', '--version', '1.2.3', '--channel', 'chan', '--pass-through=--cbuild-arg', '--pass-through=bar', 'eve-full-tryjob', 'eve-release-tryjob', ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testRemoteProductionBranchProductionConfig(self): """Test a production job on a branch for a production config wo/confirm.""" self.SetupCommandMock([ '--production', '--branch', 'foo', 'eve-pre-cq', 'eve-release' ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testMinimalCbuildbot(self): """Test option verification with simplest normal options.""" self.SetupCommandMock([ '--cbuildbot', 'amd64-generic-full', ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testNoPatchesYes(self): """Test option using yes to force an unknown config, no patches.""" self.SetupCommandMock([ '--yes', 'unknown-config' ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testProduction(self): """Test option verification with production/no patches.""" self.SetupCommandMock([ '--production', 'eve-pre-cq', 'eve-release' ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testEmpty(self): """Test option verification with no options.""" self.SetupCommandMock([]) with self.assertRaises(cros_build_lib.DieSystemExit) as cm: cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config) self.assertEqual(cm.exception.code, 1)
def testLocalTryjobProductionConfig(self): """Test option verification local tryjob w/production config.""" self.SetupCommandMock(['--local', 'eve-release']) with self.assertRaises(cros_build_lib.DieSystemExit) as cm: cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config) self.assertEqual(cm.exception.code, 1)
def testUnknownBuildYes(self): """Test option using yes to force accepting an unknown config.""" self.SetupCommandMock([ '--yes', '-g', '123', 'unknown-config' ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testMinimalLocal(self): """Test option verification with simplest normal options.""" self.SetupCommandMock([ '-g', '123', '--local', 'amd64-generic-pre-cq', ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testBranchProductionUnknownConfig(self): """Test option verification with production configs on branches.""" # We have no way of knowing if the config is production or not on a branch, # so don't prompt at all self.SetupCommandMock( ['--branch', 'old_branch', '--production', 'bogus-config']) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testUnknownConfig(self): """Test option verification with production configs on branches.""" # We have no way of knowing if the config is production or not on a branch, # so don't prompt at all self.SetupCommandMock(['bogus-config']) with self.assertRaises(PromptException): cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)
def testMinimal(self): """Test option verification with simplest normal options.""" self.SetupCommandMock([ '-g', '123', 'amd64-generic-full-tryjob', ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config) self.assertIsNone(self.cmd_mock.inst.options.buildroot)
def testListProduction(self): """Test option verification with config list behavior.""" self.SetupCommandMock([ '--list', '--production', ]) with self.assertRaises(cros_build_lib.DieSystemExit) as cm: with cros_build_lib.OutputCapturer(quiet_fail=True): # Hide list output. cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config) self.assertEqual(cm.exception.code, 0)
def testProductionPatches(self): """Test option verification with production/patches.""" self.SetupCommandMock([ '--production', '--gerrit-patches', '123', '-g', '*123', '-g', '123..456', 'eve-full-tryjob', 'eve-release' ]) with self.assertRaises(cros_build_lib.DieSystemExit) as cm: cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config) self.assertEqual(cm.exception.code, 1)
def testBranchProductionConfigTryjob(self): """Test option verification with production configs on branches.""" # We have no way of knowing if the config is production or not on a branch, # so don't prompt at all self.SetupCommandMock([ '--branch', 'old_branch', '--gerrit-patches', '123', '-g', '*123', '-g', '123..456', 'eve-release' ]) cros_tryjob.VerifyOptions(self.cmd_mock.inst.options, self.site_config)