def testIntegrationNmoBoard(self): """Tests that we successfully generate a nmo control file.""" board = 'x86-mario' branch = '24' target = '3000.0.0' src = '2999.0.0' argv = ['--nmo', '--dump_dir', self.tmpdir, '--dump', target, board] # Return npo delta gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % target)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_R%s-%s_%s_delta_dev.bin' % ( branch, src, branch, target, board)) # Return target full payload gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % src)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_%s_full_dev.bin' % ( branch, src, board)) self.mox.ReplayAll() self.assertEquals(full_release_test.main(argv), 0) self.assertTrue( _DoesControlFileHaveSourceTarget( os.path.join(self.tmpdir, board, 'control.nmo_delta_%s' % src), src, target)) self.mox.VerifyAll()
def testIntegrationNpoWithArchiveUrl(self): """Successfully generate a npo control file with custom url.""" board = 'x86-mario' branch = '24' target = '3000.0.0' src = '3000.0.0' archive_url = 'gs://chromeos-image-archive/blah-dir/not_a_version' argv = [ '--npo', '--dump_dir', self.tmpdir, '--dump', '--archive_url', archive_url, target, board ] # Return npo delta gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains(archive_url)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_R%s-%s_%s_delta_dev.bin' % ( branch, src, branch, target, board)) # Return target full payload gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains(archive_url)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_%s_full_dev.bin' % ( branch, src, board)) self.mox.ReplayAll() self.assertEquals(full_release_test.main(argv), 0) self.assertTrue( _DoesControlFileHaveSourceTarget( os.path.join(self.tmpdir, board, 'control.npo_delta_%s' % src), src, target)) self.mox.VerifyAll()
def testIntegrationNpoAllBoards(self): """Tests that we successfully generate a npo control file 4 all boards. """ boards = ['stumpy', 'lumpy', 'bumpy'] branch = '24' target = '3000.0.0' src = '3000.0.0' argv = ['--npo', '-n', target] + boards for board in boards: # Return npo delta gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % target)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_R%s-%s_%s_delta_dev.bin' % ( branch, src, branch, target, board)) # Return target full payload gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % src)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_%s_full_dev.bin' % ( branch, src, board)) self.mox.ReplayAll() self.assertEquals(full_release_test.main(argv), 0) self.mox.VerifyAll() self.mox.ResetAll() # Verify we still run all of them even if one fails. bad_board = 'stumpy' for board in boards: # Return npo delta if board == bad_board: gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % target)), mox.IgnoreArg()).\ AndReturn('NO DELTAS FOR YOU') continue gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % target)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_R%s-%s_%s_delta_dev.bin' % ( branch, src, branch, target, board)) # Return target full payload gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % src)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_%s_full_dev.bin' % ( branch, src, board)) self.mox.ReplayAll() self.assertEquals(full_release_test.main(argv), 0) self.mox.VerifyAll()
def testIntegrationSpecificBoardFail(self): """Tests we don't generate a specific test if either payload missing.""" board = 'x86-mario' branch = '24' target = '3000.0.0' src = '1234.0.0' argv = [ '--specific', src, '--dump_dir', self.tmpdir, '--dump', target, board ] # Return target full payload gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % target)), mox.IgnoreArg()).\ AndReturn('chromeos_R%s-%s_%s_full_dev.bin' % ( branch, target, board)) # No src full payload gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % src)), mox.IgnoreArg()).\ AndReturn('SOME OTHER DATA') self.mox.ReplayAll() self.assertEquals(full_release_test.main(argv), 1) self.mox.VerifyAll() self.mox.ResetAll() # Return target full payload gsutil_util.GSUtilRun(mox.And( mox.StrContains('gsutil cat'), mox.StrContains('%s/UPLOADED' % target)), mox.IgnoreArg()).\ AndReturn('SOME OTHER DATA') self.mox.ReplayAll() self.assertEquals(full_release_test.main(argv), 1) self.mox.VerifyAll()