go: go.chromium.org/chromiumos/infra/go/cmd/branch_util/test Index | Files

package test

import "go.chromium.org/chromiumos/infra/go/cmd/branch_util/test"

Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Package Files

test_harness.go

Constants

const (
    RemoteCros              = "cros"
    RemoteCrosInternal      = "cros-internal"
    ProjectManifest         = "manifest"
    ProjectManifestInternal = "manifest-internal"
)

Variables

var (
    DefaultRemotes = []repo.Remote{
        {Name: RemoteCros},
        {Name: RemoteCrosInternal},
    }
    DefaultVersionProject = repo.Project{
        Name:       "chromiumos-overlay/overlays/chromiumos-overlay",
        Path:       "src/third_party/chromiumos-overlay",
        RemoteName: RemoteCros,
    }
    DefaultManifestProject = repo.Project{
        Name:       "chromiumos/" + ProjectManifest,
        Path:       ProjectManifest,
        RemoteName: RemoteCros,
    }
    DefaultManifestInternalProject = repo.Project{
        Name:       "chromiumos/" + ProjectManifestInternal,
        Path:       ProjectManifestInternal,
        RemoteName: RemoteCrosInternal,
    }
    DefaultProjects = []repo.Project{

        DefaultVersionProject,

        DefaultManifestProject,
        DefaultManifestInternalProject,
    }

    // Default config for a CrOS repo harness.
    DefaultCrosHarnessConfig = CrosRepoHarnessConfig{
        Manifest: repo.Manifest{
            Projects: DefaultProjects,
            Remotes:  DefaultRemotes,
            Default: repo.Default{
                RemoteName: RemoteCros,
                Revision:   "refs/heads/main",
            },
        },
        VersionProject: DefaultVersionProject.Name,
    }
)

func AssertNoDefaultRevisions Uses

func AssertNoDefaultRevisions(manifest repo.Manifest) error

AssertNoDefaultRevisions asserts that the given manifest has no default revisions.

type CrosRepoHarness Uses

type CrosRepoHarness struct {
    Harness rh.RepoHarness
    // contains filtered or unexported fields
}

func (*CrosRepoHarness) AssertCommentsPersist Uses

func (r *CrosRepoHarness) AssertCommentsPersist(
    project rh.RemoteProject, branch string, sourceManifestFiles map[string]string) error

AssertCommentsPersist asserts that the comments from the source manifests (i.e. the manifests of the source branch) persist in the new branch.

func (*CrosRepoHarness) AssertCrosBranchFromManifest Uses

func (r *CrosRepoHarness) AssertCrosBranchFromManifest(manifest repo.Manifest, branch string, sourceBranch string) error

AssertCrosBranchFromManifest asserts that the specified CrOS branch descends from the given manifest. sourceBranch should be set if branch was the result of a branch rename.

func (*CrosRepoHarness) AssertCrosBranches Uses

func (r *CrosRepoHarness) AssertCrosBranches(branches []string) error

AssertCrosBranches asserts that remote projects have the expected chromiumos branches.

func (*CrosRepoHarness) AssertCrosBranchesMissing Uses

func (r *CrosRepoHarness) AssertCrosBranchesMissing(branches []string) error

AssertCrosBranchesMissing asserts that the specified chromium branch does not exist in any projects.

func (*CrosRepoHarness) AssertCrosVersion Uses

func (r *CrosRepoHarness) AssertCrosVersion(branch string, version mv.VersionInfo) error

AssertCrosVersion asserts that chromeos_version.sh has the expected version numbers.

func (*CrosRepoHarness) AssertManifestProjectRepaired Uses

func (r *CrosRepoHarness) AssertManifestProjectRepaired(
    project rh.RemoteProject, branch string, manifestFiles []string) error

AssertManifestProjectRepaired asserts that the specified manifest XML files in the specified branch of a project were repaired. This function assumes that r.Harness.SyncLocalCheckout() has just been run.

func (*CrosRepoHarness) AssertMinimalManifestChanges Uses

func (r *CrosRepoHarness) AssertMinimalManifestChanges(
    project rh.RemoteProject, branch string, expectedManifestFiles map[string]string) error

AssertMinimalManifestChanges asserts that the manifests in project/branch exactly match the expected contents with three exceptions: 1. Ignore whitespace. 2. Ignore revision attributes (which are checked in other tests). 3. Ignore fetch attributes (which are just mock values in the test harness). 4. Ignore upstream attributes (doing so makes branch_util_test.go cleaner and they aren't really relevant anyways)

func (*CrosRepoHarness) AssertProjectRevisionsMatchBranch Uses

func (r *CrosRepoHarness) AssertProjectRevisionsMatchBranch(manifest repo.Manifest, branch, sourceBranch string) error

AssertProjectRevisionsMatchBranch asserts that the project revisions match the given CrOS branch.

func (*CrosRepoHarness) GetRecentRemoteSnapshot Uses

func (r *CrosRepoHarness) GetRecentRemoteSnapshot(remote string) (string, error)

GetRecentRemoteSnapshot returns the path of the most recent snapshot for a particular remote.

func (*CrosRepoHarness) Initialize Uses

func (r *CrosRepoHarness) Initialize(config *CrosRepoHarnessConfig) error

func (*CrosRepoHarness) SetVersion Uses

func (r *CrosRepoHarness) SetVersion(branch string, version mv.VersionInfo) error

SetVersion sets the version file contents for the specified branch. If branch is not set, will use the version project's revision.

func (*CrosRepoHarness) TakeSnapshot Uses

func (r *CrosRepoHarness) TakeSnapshot() error

TakeSnapshot takes a snapshot of the current state of each remote and stores them within the harness struct.

func (*CrosRepoHarness) Teardown Uses

func (r *CrosRepoHarness) Teardown() error

type CrosRepoHarnessConfig Uses

type CrosRepoHarnessConfig struct {
    // Initialize() will create a test harness with
    // the appropriate remote repos and a local repo.
    // Both remote and local repos will have the appropriate
    // projects created (with initialized git repos inside them).
    Manifest repo.Manifest
    // Version info project name. Should exist in Manifest.
    VersionProject string
}

Package test imports 13 packages (graph). Updated 2020-10-27. Refresh now. Tools for package owners.