Beispiel #1
0
    def setUp(self):
        self.push_mock = self.PatchObject(git, 'CreatePushBranch')

        self.source_repo = 'ssh://source/repo'
        self.manifest_repo = 'ssh://manifest/repo'
        self.version_file = 'version-file.sh'
        self.branch = 'master'
        self.build_name = 'amd64-generic'
        self.incr_type = 'branch'
        self.buildstore = FakeBuildStore()

        # Create tmp subdirs based on the one provided TempDirMixin.
        self.tmpdir = os.path.join(self.tempdir, 'base')
        osutils.SafeMakedirs(self.tmpdir)
        self.tmpmandir = os.path.join(self.tempdir, 'man')
        osutils.SafeMakedirs(self.tmpmandir)

        repo = repository.RepoRepository(self.source_repo,
                                         self.tmpdir,
                                         self.branch,
                                         depth=1)
        self.manager = lkgm_manager.LKGMManager(repo,
                                                self.manifest_repo,
                                                self.build_name,
                                                constants.PFQ_TYPE,
                                                'branch',
                                                force=False,
                                                branch=self.branch,
                                                buildstore=self.buildstore,
                                                dry_run=True)
        self.manager.manifest_dir = self.tmpmandir
        self.manager.lkgm_path = os.path.join(self.tmpmandir,
                                              constants.LKGM_MANIFEST)

        self.manager.all_specs_dir = '/LKGM/path'
        manifest_dir = self.manager.manifest_dir
        self.manager.specs_for_builder = os.path.join(
            manifest_dir, self.manager.rel_working_dir, 'build-name',
            '%(builder)s')
        self.manager.SLEEP_TIMEOUT = 0
    def setUp(self):
        """Setup"""
        self.source_repo = 'ssh://source/repo'
        self.manifest_version_url = 'fake manifest url'
        self.branch = 'master'
        self.build_name = 'master-mst-android-pfq'
        self.incr_type = 'branch'
        self.next_version = 'next_version'
        self.sync_stage = None

        self.repo = repository.RepoRepository(self.source_repo, self.tempdir,
                                              self.branch)

        # Create and set up a fake cidb instance.
        self.fake_db = fake_cidb.FakeCIDBConnection()
        self.buildstore = FakeBuildStore(self.fake_db)
        cidb.CIDBConnectionFactory.SetupMockCidb(self.fake_db)

        self.manager = lkgm_manager.LKGMManager(
            source_repo=self.repo,
            manifest_repo=self.manifest_version_url,
            build_names=[self.build_name],
            build_type=constants.ANDROID_PFQ_TYPE,
            incr_type=self.incr_type,
            force=False,
            branch=self.branch,
            buildstore=self.buildstore,
            dry_run=True)

        self.PatchObject(buildbucket_lib,
                         'GetServiceAccount',
                         return_value=True)
        self.PatchObject(auth.AuthorizedHttp, '__init__', return_value=None)
        self.PatchObject(buildbucket_lib.BuildbucketClient,
                         '_GetHost',
                         return_value=buildbucket_lib.BUILDBUCKET_TEST_HOST)

        self._Prepare()
Beispiel #3
0
  def _GetInitializedManager(self, internal):
    """Returns an initialized lkgm manager.

    Args:
      internal: Boolean.  True if this is using an internal manifest.

    Returns:
      lkgm_manager.LKGMManager.
    """
    increment = self.VersionIncrementType()
    return lkgm_manager.LKGMManager(
        source_repo=self.repo,
        manifest_repo=self._GetManifestVersionsRepoUrl(internal=internal),
        manifest=self._run.config.manifest,
        build_names=self._run.GetBuilderIds(),
        build_type=self._run.config.build_type,
        incr_type=increment,
        force=self._force,
        branch=self._run.manifest_branch,
        dry_run=self._run.options.debug,
        config=self._run.config,
        metadata=self._run.attrs.metadata,
        buildstore=self.buildstore,
        buildbucket_client=self.buildbucket_client)