test

package
v0.0.0-...-e560ebb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package test defines a branch_util-specific test harness.

Index

Constants

View Source
const (
	// RemoteCros is the remote name for the external Chromiumos project.
	RemoteCros = "cros"
	// RemoteCrosInternal is the remote name for the internal Chromiumos project.
	RemoteCrosInternal = "cros-internal"
	// ProjectManifest is the name of the external manifest repository.
	ProjectManifest = "manifest"
	// ProjectManifestInternal is the name of the internal manifest repository.
	ProjectManifestInternal = "manifest-internal"
)

Variables

View Source
var (
	// DefaultRemotes is a list of the default remotes for a Chromiumos checkout.
	DefaultRemotes = []repo.Remote{
		{Name: RemoteCros},
		{Name: RemoteCrosInternal},
	}
	// DefaultVersionProject is the default project that contains version information.
	DefaultVersionProject = repo.Project{
		Name:       "chromiumos/overlays/chromiumos-overlay",
		Path:       "src/third_party/chromiumos-overlay",
		RemoteName: RemoteCros,
	}
	// DefaultManifestProject is the default external manifest project.
	DefaultManifestProject = repo.Project{
		Name:       "chromiumos/" + ProjectManifest,
		Path:       ProjectManifest,
		RemoteName: RemoteCros,
	}
	// DefaultManifestInternalProject is the default internal manifest project.
	DefaultManifestInternalProject = repo.Project{
		Name:       "chromiumos/" + ProjectManifestInternal,
		Path:       ProjectManifestInternal,
		RemoteName: RemoteCrosInternal,
	}
	// DefaultProjects contains a list of projects that should be included in
	// tests by default.
	DefaultProjects = []repo.Project{

		DefaultVersionProject,

		DefaultManifestProject,
		DefaultManifestInternalProject,
	}

	// DefaultCrosHarnessConfig is the 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,
	}
)

Functions

func AssertNoDefaultRevisions

func AssertNoDefaultRevisions(manifest repo.Manifest) error

AssertNoDefaultRevisions asserts that the given manifest has no default revisions.

Types

type CrosRepoHarness

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

CrosRepoHarness is a cros-specific test harness.

func (*CrosRepoHarness) AssertCommentsPersist

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

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

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

AssertCrosBranches asserts that remote projects have the expected chromiumos branches.

func (*CrosRepoHarness) AssertCrosBranchesMissing

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

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

func (*CrosRepoHarness) AssertCrosVersion

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

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

func (*CrosRepoHarness) AssertManifestProjectRepaired

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

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

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

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

func (*CrosRepoHarness) Initialize

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

Initialize creates a new CrosRepoHarnes based on config.

func (*CrosRepoHarness) SetVersion

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) Teardown

func (r *CrosRepoHarness) Teardown() error

Teardown tears down a CrosRepoHarness.

type CrosRepoHarnessConfig

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
}

CrosRepoHarnessConfig contains config for a CrosRepoHarness.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL