def testGetLatestCandidateOneRetry(self):
    """Makes sure we can get the latest candidate even on retry."""
    self.mox.StubOutWithMock(repository.RepoRepository, 'Sync')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'RefreshManifestCheckout')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'InitializeManifestVariables')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'PushSpecChanges')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'SetInFlight')

    my_info = lkgm_manager._LKGMCandidateInfo('1.2.4')
    most_recent_candidate = lkgm_manager._LKGMCandidateInfo('1.2.4-rc12',
                                                            CHROME_BRANCH)

    lkgm_manager.LKGMManager.CheckoutSourceCode()
    lkgm_manager.LKGMManager.RefreshManifestCheckout()
    lkgm_manager.LKGMManager.GetCurrentVersionInfo().AndReturn(my_info)
    lkgm_manager.LKGMManager.InitializeManifestVariables(my_info)

    lkgm_manager.LKGMManager.SetInFlight(most_recent_candidate.VersionString(),
                                         dashboard_url=None)
    repository.RepoRepository.Sync(
        self._GetPathToManifest(most_recent_candidate))

    self.manager.latest_unprocessed = '1.2.4-rc12'
    self.mox.ReplayAll()
    candidate = self.manager.GetLatestCandidate()
    self.assertEqual(candidate, self._GetPathToManifest(most_recent_candidate))
    self.mox.VerifyAll()
Exemple #2
0
    def testCreateNewCandidate(self):
        """Tests that we can create a new candidate and uprev an old rc."""
        # Let's stub out other LKGMManager calls cause they're already
        # unit tested.

        my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')
        most_recent_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc12')
        self.manager.latest = most_recent_candidate.VersionString()

        new_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc13')
        new_manifest = 'some_manifest'

        build_id = 59271

        # Patch out our RepoRepository to make sure we don't corrupt real repo.
        cros_source_mock = self.PatchObject(self.manager, 'cros_source')
        cros_source_mock.branch = 'master'
        cros_source_mock.directory = '/foo/repo'

        self.PatchObject(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
        self.PatchObject(lkgm_manager.LKGMManager,
                         'CreateManifest',
                         return_value=new_manifest)
        self.PatchObject(lkgm_manager.LKGMManager,
                         'HasCheckoutBeenBuilt',
                         return_value=False)

        # Do manifest refresh work.
        self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
        self.PatchObject(lkgm_manager.LKGMManager,
                         'GetCurrentVersionInfo',
                         return_value=my_info)
        init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                     'InitializeManifestVariables')

        # For _AdjustRepoCheckoutToLocalManifest.
        self.PatchObject(repository, 'CloneGitRepo')
        self.PatchObject(git, 'CreateBranch')

        # Publish new candidate.
        publish_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                        'PublishManifest')

        candidate_path = self.manager.CreateNewCandidate(build_id=build_id)
        self.assertEqual(candidate_path,
                         self._GetPathToManifest(new_candidate))

        publish_mock.assert_called_once_with(new_manifest,
                                             new_candidate.VersionString(),
                                             build_id=build_id)
        init_mock.assert_called_once_with(my_info)
        self.push_mock.assert_called_once_with(mock.ANY, mock.ANY, sync=False)
  def testVersionCompare(self):
    """Tests whether our comparision method works."""
    info1 = lkgm_manager._LKGMCandidateInfo('1.2.3-rc1')
    info2 = lkgm_manager._LKGMCandidateInfo('1.2.3-rc2')
    info3 = lkgm_manager._LKGMCandidateInfo('1.2.200-rc1')
    info4 = lkgm_manager._LKGMCandidateInfo('1.4.3-rc1')

    self.assertTrue(info2 > info1)
    self.assertTrue(info3 > info1)
    self.assertTrue(info3 > info2)
    self.assertTrue(info4 > info1)
    self.assertTrue(info4 > info2)
    self.assertTrue(info4 > info3)
Exemple #4
0
    def testCreateNewCandidateReturnNoneIfNoWorkToDo(self):
        """Tests that we return nothing if there is nothing to create."""
        new_manifest = 'some_manifest'
        my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')

        # Patch out our RepoRepository to make sure we don't corrupt real repo.
        cros_source_mock = self.PatchObject(self.manager, 'cros_source')
        cros_source_mock.branch = 'master'
        cros_source_mock.directory = '/foo/repo'

        self.PatchObject(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
        self.PatchObject(lkgm_manager.LKGMManager,
                         'CreateManifest',
                         return_value=new_manifest)
        self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
        self.PatchObject(lkgm_manager.LKGMManager,
                         'GetCurrentVersionInfo',
                         return_value=my_info)
        init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                     'InitializeManifestVariables')
        self.PatchObject(lkgm_manager.LKGMManager,
                         'HasCheckoutBeenBuilt',
                         return_value=True)

        candidate = self.manager.CreateNewCandidate()
        self.assertEqual(candidate, None)
        init_mock.assert_called_once_with(my_info)
  def testCreateNewCandidateReturnNoneIfNoWorkToDo(self):
    """Tests that we return nothing if there is nothing to create."""
    new_manifest = 'some_manifest'
    my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')

    # Patch out our RepoRepository to make sure we don't corrupt real repo.
    cros_source_mock = self.PatchObject(self.manager, 'cros_source')
    cros_source_mock.branch = 'master'
    cros_source_mock.directory = '/foo/repo'

    self.PatchObject(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
    self.PatchObject(lkgm_manager.LKGMManager, 'CreateManifest',
                     return_value=new_manifest)
    self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
    self.PatchObject(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo',
                     return_value=my_info)
    init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                 'InitializeManifestVariables')
    self.PatchObject(lkgm_manager.LKGMManager, 'HasCheckoutBeenBuilt',
                     return_value=True)

    # For _AdjustRepoCheckoutToLocalManifest.
    self.PatchObject(repository, 'CloneGitRepo')
    self.PatchObject(git, 'CreateBranch')

    candidate = self.manager.CreateNewCandidate()
    self.assertEqual(candidate, None)
    init_mock.assert_called_once_with(my_info)
  def testCreateNewCandidate(self):
    """Tests that we can create a new candidate and uprev an old rc."""
    # Let's stub out other LKGMManager calls cause they're already
    # unit tested.

    my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')
    most_recent_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc12')
    self.manager.latest = most_recent_candidate.VersionString()

    new_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc13')
    new_manifest = 'some_manifest'

    build_id = 59271

    # Patch out our RepoRepository to make sure we don't corrupt real repo.
    cros_source_mock = self.PatchObject(self.manager, 'cros_source')
    cros_source_mock.branch = 'master'
    cros_source_mock.directory = '/foo/repo'

    self.PatchObject(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
    self.PatchObject(lkgm_manager.LKGMManager, 'CreateManifest',
                     return_value=new_manifest)
    self.PatchObject(lkgm_manager.LKGMManager, 'HasCheckoutBeenBuilt',
                     return_value=False)

    # Do manifest refresh work.
    self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
    self.PatchObject(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo',
                     return_value=my_info)
    init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                 'InitializeManifestVariables')

    # For _AdjustRepoCheckoutToLocalManifest.
    self.PatchObject(repository, 'CloneGitRepo')
    self.PatchObject(git, 'CreateBranch')

    # Publish new candidate.
    publish_mock = self.PatchObject(lkgm_manager.LKGMManager, 'PublishManifest')

    candidate_path = self.manager.CreateNewCandidate(build_id=build_id)
    self.assertEqual(candidate_path, self._GetPathToManifest(new_candidate))

    publish_mock.assert_called_once_with(new_manifest,
                                         new_candidate.VersionString(),
                                         build_id=build_id)
    init_mock.assert_called_once_with(my_info)
    self.push_mock.assert_called_once_with(mock.ANY, mock.ANY, sync=False)
Exemple #7
0
    def testCreateFromManifest(self):
        """Tests that we can create a new candidate from another manifest."""
        # Let's stub out other LKGMManager calls cause they're already
        # unit tested.

        version = '2010.0.0-rc7'
        my_info = lkgm_manager._LKGMCandidateInfo('2010.0.0')
        new_candidate = lkgm_manager._LKGMCandidateInfo(version)
        manifest = ('/tmp/manifest-versions-internal/paladin/buildspecs/'
                    '20/%s.xml' % version)
        new_manifest = '/path/to/tmp/file.xml'

        build_id = 20162

        site_params = config_lib.GetSiteParams()
        # Patch out our RepoRepository to make sure we don't corrupt real repo.
        self.PatchObject(self.manager, 'cros_source')
        filter_mock = self.PatchObject(manifest_version,
                                       'FilterManifest',
                                       return_value=new_manifest)

        # Do manifest refresh work.
        self.PatchObject(lkgm_manager.LKGMManager,
                         'GetCurrentVersionInfo',
                         return_value=my_info)
        self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
        init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                     'InitializeManifestVariables')

        # Publish new candidate.
        publish_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                        'PublishManifest')

        candidate_path = self.manager.CreateFromManifest(manifest,
                                                         build_id=build_id)
        self.assertEqual(candidate_path,
                         self._GetPathToManifest(new_candidate))
        self.assertEqual(self.manager.current_version, version)

        filter_mock.assert_called_once_with(
            manifest, whitelisted_remotes=site_params.EXTERNAL_REMOTES)
        publish_mock.assert_called_once_with(new_manifest,
                                             version,
                                             build_id=build_id)
        init_mock.assert_called_once_with(my_info)
        self.push_mock.assert_called_once_with(mock.ANY, mock.ANY, sync=False)
Exemple #8
0
    def testVersionCompare(self):
        """Tests whether our comparision method works."""
        info0 = lkgm_manager._LKGMCandidateInfo('5.2.3-rc100')
        info1 = lkgm_manager._LKGMCandidateInfo('1.2.3-rc1')
        info2 = lkgm_manager._LKGMCandidateInfo('1.2.3-rc2')
        info3 = lkgm_manager._LKGMCandidateInfo('1.2.200-rc1')
        info4 = lkgm_manager._LKGMCandidateInfo('1.4.3-rc1')

        self.assertGreater(info0, info1)
        self.assertGreater(info0, info2)
        self.assertGreater(info0, info3)
        self.assertGreater(info0, info4)
        self.assertGreater(info2, info1)
        self.assertGreater(info3, info1)
        self.assertGreater(info3, info2)
        self.assertGreater(info4, info1)
        self.assertGreater(info4, info2)
        self.assertGreater(info4, info3)
        self.assertEqual(info0, info0)
        self.assertEqual(info1, info1)
        self.assertEqual(info2, info2)
        self.assertEqual(info3, info3)
        self.assertEqual(info4, info4)
        self.assertNotEqual(info0, info1)
        self.assertNotEqual(info0, info2)
        self.assertNotEqual(info0, info3)
        self.assertNotEqual(info0, info4)
        self.assertNotEqual(info1, info0)
        self.assertNotEqual(info1, info2)
        self.assertNotEqual(info1, info3)
        self.assertNotEqual(info1, info4)
        self.assertNotEqual(info2, info0)
        self.assertNotEqual(info2, info1)
        self.assertNotEqual(info2, info3)
        self.assertNotEqual(info2, info4)
        self.assertNotEqual(info3, info0)
        self.assertNotEqual(info3, info1)
        self.assertNotEqual(info3, info2)
        self.assertNotEqual(info3, info4)
        self.assertNotEqual(info4, info0)
        self.assertNotEqual(info4, info1)
        self.assertNotEqual(info4, info1)
        self.assertNotEqual(info4, info3)
  def testCreateNewCandidate(self):
    """Tests that we can create a new candidate and uprev an old rc."""
    # Let's stub out other LKGMManager calls cause they're already
    # unit tested.
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'RefreshManifestCheckout')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'InitializeManifestVariables')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'HasCheckoutBeenBuilt')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'CreateManifest')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'PublishManifest')

    my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')
    most_recent_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc12')
    self.manager.latest = most_recent_candidate.VersionString()

    new_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc13')
    new_manifest = 'some_manifest'

    build_id = 59271

    lkgm_manager.LKGMManager.CheckoutSourceCode()
    lkgm_manager.LKGMManager.CreateManifest().AndReturn(new_manifest)
    lkgm_manager.LKGMManager.HasCheckoutBeenBuilt().AndReturn(False)

    # Do manifest refresh work.
    lkgm_manager.LKGMManager.RefreshManifestCheckout()
    git.CreatePushBranch(mox.IgnoreArg(), mox.IgnoreArg(), sync=False)
    lkgm_manager.LKGMManager.GetCurrentVersionInfo().AndReturn(my_info)
    lkgm_manager.LKGMManager.InitializeManifestVariables(my_info)

    # Publish new candidate.
    lkgm_manager.LKGMManager.PublishManifest(new_manifest,
                                             new_candidate.VersionString(),
                                             build_id=build_id)

    self.mox.ReplayAll()
    candidate_path = self.manager.CreateNewCandidate(build_id=build_id)
    self.assertEqual(candidate_path, self._GetPathToManifest(new_candidate))
    self.mox.VerifyAll()
  def testVersionCompare(self):
    """Tests whether our comparision method works."""
    info0 = lkgm_manager._LKGMCandidateInfo('5.2.3-rc100')
    info1 = lkgm_manager._LKGMCandidateInfo('1.2.3-rc1')
    info2 = lkgm_manager._LKGMCandidateInfo('1.2.3-rc2')
    info3 = lkgm_manager._LKGMCandidateInfo('1.2.200-rc1')
    info4 = lkgm_manager._LKGMCandidateInfo('1.4.3-rc1')

    self.assertGreater(info0, info1)
    self.assertGreater(info0, info2)
    self.assertGreater(info0, info3)
    self.assertGreater(info0, info4)
    self.assertGreater(info2, info1)
    self.assertGreater(info3, info1)
    self.assertGreater(info3, info2)
    self.assertGreater(info4, info1)
    self.assertGreater(info4, info2)
    self.assertGreater(info4, info3)
    self.assertEqual(info0, info0)
    self.assertEqual(info1, info1)
    self.assertEqual(info2, info2)
    self.assertEqual(info3, info3)
    self.assertEqual(info4, info4)
    self.assertNotEqual(info0, info1)
    self.assertNotEqual(info0, info2)
    self.assertNotEqual(info0, info3)
    self.assertNotEqual(info0, info4)
    self.assertNotEqual(info1, info0)
    self.assertNotEqual(info1, info2)
    self.assertNotEqual(info1, info3)
    self.assertNotEqual(info1, info4)
    self.assertNotEqual(info2, info0)
    self.assertNotEqual(info2, info1)
    self.assertNotEqual(info2, info3)
    self.assertNotEqual(info2, info4)
    self.assertNotEqual(info3, info0)
    self.assertNotEqual(info3, info1)
    self.assertNotEqual(info3, info2)
    self.assertNotEqual(info3, info4)
    self.assertNotEqual(info4, info0)
    self.assertNotEqual(info4, info1)
    self.assertNotEqual(info4, info1)
    self.assertNotEqual(info4, info3)
  def testCreateFromManifest(self):
    """Tests that we can create a new candidate from another manifest."""
    # Let's stub out other LKGMManager calls cause they're already
    # unit tested.
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'RefreshManifestCheckout')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'InitializeManifestVariables')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             '_FilterCrosInternalProjectsFromManifest')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'PublishManifest')

    version = '2010.0.0-rc7'
    my_info = lkgm_manager._LKGMCandidateInfo('2010.0.0')
    new_candidate = lkgm_manager._LKGMCandidateInfo(version)
    manifest = ('/tmp/manifest-versions-internal/paladin/buildspecs/'
                '20/%s.xml' % version)
    new_manifest = '/path/to/tmp/file.xml'

    build_id = 20162

    lkgm_manager.LKGMManager._FilterCrosInternalProjectsFromManifest(
        manifest).AndReturn(new_manifest)

    # Do manifest refresh work.
    lkgm_manager.LKGMManager.GetCurrentVersionInfo().AndReturn(my_info)
    lkgm_manager.LKGMManager.RefreshManifestCheckout()
    lkgm_manager.LKGMManager.InitializeManifestVariables(my_info)
    git.CreatePushBranch(mox.IgnoreArg(), mox.IgnoreArg(), sync=False)

    # Publish new candidate.
    lkgm_manager.LKGMManager.PublishManifest(new_manifest, version,
                                             build_id=build_id)

    self.mox.ReplayAll()
    candidate_path = self.manager.CreateFromManifest(manifest,
                                                     build_id=build_id)
    self.assertEqual(candidate_path, self._GetPathToManifest(new_candidate))
    self.assertEqual(self.manager.current_version, version)
    self.mox.VerifyAll()
  def testCreateFromManifest(self):
    """Tests that we can create a new candidate from another manifest."""
    # Let's stub out other LKGMManager calls cause they're already
    # unit tested.

    version = '2010.0.0-rc7'
    my_info = lkgm_manager._LKGMCandidateInfo('2010.0.0')
    new_candidate = lkgm_manager._LKGMCandidateInfo(version)
    manifest = ('/tmp/manifest-versions-internal/paladin/buildspecs/'
                '20/%s.xml' % version)
    new_manifest = '/path/to/tmp/file.xml'

    build_id = 20162

    # Patch out our RepoRepository to make sure we don't corrupt real repo.
    self.PatchObject(self.manager, 'cros_source')
    filter_mock = self.PatchObject(manifest_version, 'FilterManifest',
                                   return_value=new_manifest)

    # Do manifest refresh work.
    self.PatchObject(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo',
                     return_value=my_info)
    self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
    init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                 'InitializeManifestVariables')

    # Publish new candidate.
    publish_mock = self.PatchObject(lkgm_manager.LKGMManager, 'PublishManifest')

    candidate_path = self.manager.CreateFromManifest(manifest,
                                                     build_id=build_id)
    self.assertEqual(candidate_path, self._GetPathToManifest(new_candidate))
    self.assertEqual(self.manager.current_version, version)

    filter_mock.assert_called_once_with(
        manifest, whitelisted_remotes=site_config.params.EXTERNAL_REMOTES)
    publish_mock.assert_called_once_with(new_manifest, version,
                                         build_id=build_id)
    init_mock.assert_called_once_with(my_info)
    self.push_mock.assert_called_once_with(mock.ANY, mock.ANY, sync=False)
  def testCreateNewCandidate(self):
    """Tests that we can create a new candidate and uprev an old rc."""
    # Let's stub out other LKGMManager calls cause they're already
    # unit tested.

    my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')
    most_recent_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc12')
    self.manager.latest = most_recent_candidate.VersionString()

    new_candidate = lkgm_manager._LKGMCandidateInfo('1.2.3-rc13')
    new_manifest = 'some_manifest'

    build_id = 59271

    self.PatchObject(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
    self.PatchObject(lkgm_manager.LKGMManager, 'CreateManifest',
                     return_value=new_manifest)
    self.PatchObject(lkgm_manager.LKGMManager, 'HasCheckoutBeenBuilt',
                     return_value=False)

    # Do manifest refresh work.
    self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
    self.PatchObject(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo',
                     return_value=my_info)
    init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                 'InitializeManifestVariables')

    # Publish new candidate.
    publish_mock = self.PatchObject(lkgm_manager.LKGMManager, 'PublishManifest')

    candidate_path = self.manager.CreateNewCandidate(build_id=build_id)
    self.assertEqual(candidate_path, self._GetPathToManifest(new_candidate))

    publish_mock.assert_called_once_with(new_manifest,
                                         new_candidate.VersionString(),
                                         build_id=build_id)
    init_mock.assert_called_once_with(my_info)
    self.push_mock.assert_called_once_with(mock.ANY, mock.ANY, sync=False)
  def testCreateNewCandidateReturnNoneIfNoWorkToDo(self):
    """Tests that we return nothing if there is nothing to create."""
    new_manifest = 'some_manifest'
    my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')
    self.PatchObject(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
    self.PatchObject(lkgm_manager.LKGMManager, 'CreateManifest',
                     return_value=new_manifest)
    self.PatchObject(lkgm_manager.LKGMManager, 'RefreshManifestCheckout')
    self.PatchObject(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo',
                     return_value=my_info)
    init_mock = self.PatchObject(lkgm_manager.LKGMManager,
                                 'InitializeManifestVariables')
    self.PatchObject(lkgm_manager.LKGMManager, 'HasCheckoutBeenBuilt',
                     return_value=True)

    candidate = self.manager.CreateNewCandidate()
    self.assertEqual(candidate, None)
    init_mock.assert_called_once_with(my_info)
  def testGetLatestCandidateNone(self):
    """Makes sure we get nothing if there is no work to be done."""
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'RefreshManifestCheckout')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'InitializeManifestVariables')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'CheckoutSourceCode')

    my_info = lkgm_manager._LKGMCandidateInfo('1.2.4')
    lkgm_manager.LKGMManager.CheckoutSourceCode()
    lkgm_manager.LKGMManager.RefreshManifestCheckout()
    lkgm_manager.LKGMManager.GetCurrentVersionInfo().AndReturn(my_info)
    lkgm_manager.LKGMManager.InitializeManifestVariables(my_info)

    self.mox.ReplayAll()
    self.manager.SLEEP_TIMEOUT = 0.2
    # Only run once.
    candidate = self.manager.GetLatestCandidate(timeout=0.1)
    self.assertEqual(candidate, None)
    self.mox.VerifyAll()
  def testCreateNewCandidateReturnNoneIfNoWorkToDo(self):
    """Tests that we return nothing if there is nothing to create."""
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'CheckoutSourceCode')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'HasCheckoutBeenBuilt')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'CreateManifest')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager, 'GetCurrentVersionInfo')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'RefreshManifestCheckout')
    self.mox.StubOutWithMock(lkgm_manager.LKGMManager,
                             'InitializeManifestVariables')

    new_manifest = 'some_manifest'
    my_info = lkgm_manager._LKGMCandidateInfo('1.2.3')
    lkgm_manager.LKGMManager.CheckoutSourceCode()
    lkgm_manager.LKGMManager.CreateManifest().AndReturn(new_manifest)
    lkgm_manager.LKGMManager.RefreshManifestCheckout()
    lkgm_manager.LKGMManager.GetCurrentVersionInfo().AndReturn(my_info)
    lkgm_manager.LKGMManager.InitializeManifestVariables(my_info)
    lkgm_manager.LKGMManager.HasCheckoutBeenBuilt().AndReturn(True)

    self.mox.ReplayAll()
    candidate = self.manager.CreateNewCandidate()
    self.assertEqual(candidate, None)
    self.mox.VerifyAll()
Exemple #17
0
 def testIncrementVersionPatch(self):
     """Tests whether we can increment a lkgm info."""
     info = lkgm_manager._LKGMCandidateInfo(
         version_string=FAKE_VERSION_STRING, chrome_branch=CHROME_BRANCH)
     info.IncrementVersion()
     self.assertEqual(info.VersionString(), FAKE_VERSION_STRING_NEXT)
Exemple #18
0
 def testLoadFromString(self):
     """Tests whether we can load from a string."""
     info = lkgm_manager._LKGMCandidateInfo(
         version_string=FAKE_VERSION_STRING, chrome_branch=CHROME_BRANCH)
     self.assertEqual(info.VersionString(), FAKE_VERSION_STRING)
 def testIncrementVersionPatch(self):
   """Tests whether we can increment a lkgm info."""
   info = lkgm_manager._LKGMCandidateInfo(version_string=FAKE_VERSION_STRING,
                                          chrome_branch=CHROME_BRANCH)
   info.IncrementVersion()
   self.assertEqual(info.VersionString(), FAKE_VERSION_STRING_NEXT)
 def testLoadFromString(self):
   """Tests whether we can load from a string."""
   info = lkgm_manager._LKGMCandidateInfo(version_string=FAKE_VERSION_STRING,
                                          chrome_branch=CHROME_BRANCH)
   self.assertEqual(info.VersionString(), FAKE_VERSION_STRING)