repo_harness

package
v0.0.0-...-ff0388d Latest Latest
Warning

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

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

Documentation

Overview

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

Constants

This section is empty.

Variables

View Source
var (
	CommandRunnerImpl cmd.CommandRunner = cmd.RealCommandRunner{}
)

Functions

This section is empty.

Types

type File

type File struct {
	Name     string
	Contents []byte
	Perm     os.FileMode
}

type RemoteProject

type RemoteProject struct {
	RemoteName  string
	ProjectName string
}

Identifies a remote project.

func GetRemoteProject

func GetRemoteProject(project repo.Project) RemoteProject

type RepoHarness

type RepoHarness struct {
	// contains filtered or unexported fields
}

func (*RepoHarness) AddFile

func (r *RepoHarness) AddFile(project RemoteProject, branch string, file File) (string, error)

AddFile adds a file to the specified branch in the specified remote project. Returns the sha1 of the commit that adds the file.

func (*RepoHarness) AddFiles

func (r *RepoHarness) AddFiles(project RemoteProject, branch string, files []File) (string, error)

AddFiles adds files to the specified branch in the specified remote project. Returns a map with the sha1's of the commits.

func (*RepoHarness) AssertProjectBranchEqual

func (r *RepoHarness) AssertProjectBranchEqual(project RemoteProject, branch, snapshotPath string) error

AssertProjectBranchEqual asserts that the specified branch in the project matches the corresponding branch in the given snapshot.

func (*RepoHarness) AssertProjectBranchHasAncestor

func (r *RepoHarness) AssertProjectBranchHasAncestor(project RemoteProject, branch, snapshotPath, snapshotBranch string) error

AssertProjectBranchHasAncestor asserts that the specified branch in the project descends from the given snapshot.

func (*RepoHarness) AssertProjectBranches

func (r *RepoHarness) AssertProjectBranches(project RemoteProject, branches []string) error

AssertProjectBranches asserts that the remote project has the correct branches.

func (*RepoHarness) AssertProjectBranchesExact

func (r *RepoHarness) AssertProjectBranchesExact(project RemoteProject, branches []string) error

AssertProjectBranchesExact asserts that the remote project has only the correct branches.

func (*RepoHarness) AssertProjectBranchesMissing

func (r *RepoHarness) AssertProjectBranchesMissing(project RemoteProject, branches []string) error

AssertProjectBranchesMissing asserts that the remote project does not have the specified branches.

func (*RepoHarness) CreateRemoteRef

func (r *RepoHarness) CreateRemoteRef(project RemoteProject, ref string, commit string) error

CreateRemoteRef creates a remote ref for a specific project. Otherwise, a temporary local checkout will be created and an empty commit will be used to create the remote ref.

func (*RepoHarness) GetRemotePath

func (r *RepoHarness) GetRemotePath(project RemoteProject) string

GetRemotePath returns the path to the remote project repo.

func (*RepoHarness) HarnessRoot

func (r *RepoHarness) HarnessRoot() string

func (*RepoHarness) Initialize

func (r *RepoHarness) Initialize(config *RepoHarnessConfig) error

func (*RepoHarness) Manifest

func (r *RepoHarness) Manifest() repo.Manifest

func (*RepoHarness) ReadFile

func (r *RepoHarness) ReadFile(project RemoteProject, branch, filePath string) ([]byte, error)

ReadFile reads a file from a remote.

func (*RepoHarness) Snapshot

func (r *RepoHarness) Snapshot(path string) (string, error)

Snapshot recursively copies a directory's contents to a temp dir.

func (*RepoHarness) Teardown

func (r *RepoHarness) Teardown() error

type RepoHarnessConfig

type RepoHarnessConfig 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
}

Jump to

Keyboard shortcuts

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