dep: github.com/golang/dep/internal/test/integration Index | Files

package integration

import "github.com/golang/dep/internal/test/integration"

Index

Package Files

testcase.go testproj.go

type RunFunc Uses

type RunFunc func(prog string, newargs []string, outW, errW io.Writer, dir string, env []string) error

RunFunc defines the function signature for an integration test command to execute.

type TestCase Uses

type TestCase struct {
    Commands      [][]string        `json:"commands"`
    ShouldFail    bool              `json:"should-fail"`
    ErrorExpected string            `json:"error-expected"`
    GopathInitial map[string]string `json:"gopath-initial"`
    VendorInitial map[string]string `json:"vendor-initial"`
    VendorFinal   []string          `json:"vendor-final"`
    InitPath      string            `json:"init-path"`

    RequiredFeatureFlag string `json:"feature"`
    // contains filtered or unexported fields
}

TestCase manages a test case directory structure and content

func NewTestCase Uses

func NewTestCase(t *testing.T, dir, name string) *TestCase

NewTestCase creates a new TestCase.

func (*TestCase) CompareCmdFailure Uses

func (tc *TestCase) CompareCmdFailure(gotFail bool)

CompareCmdFailure checks to see if the failure/success (in the sense of an exit code) was as expected by the test fixture.

func (*TestCase) CompareError Uses

func (tc *TestCase) CompareError(err error, stderr string)

CompareError compares expected and actual stderr output.

func (*TestCase) CompareFile Uses

func (tc *TestCase) CompareFile(goldenPath, working string)

CompareFile compares the golden file with the working result.

func (*TestCase) CompareOutput Uses

func (tc *TestCase) CompareOutput(stdout string)

CompareOutput compares expected and actual stdout output.

func (*TestCase) CompareVendorPaths Uses

func (tc *TestCase) CompareVendorPaths(gotVendorPaths []string)

CompareVendorPaths validates the vendor directory contents.

func (*TestCase) InitialPath Uses

func (tc *TestCase) InitialPath() string

InitialPath represents the initial set of files in a project.

func (*TestCase) UpdateFile Uses

func (tc *TestCase) UpdateFile(goldenPath, workingPath string)

UpdateFile updates the golden file with the working result.

func (*TestCase) UpdateOutput Uses

func (tc *TestCase) UpdateOutput(stdout string)

UpdateOutput updates the golden file for stdout with the working result.

func (*TestCase) WriteFile Uses

func (tc *TestCase) WriteFile(src string, content string) error

WriteFile writes a file using the default file permissions.

type TestProject Uses

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

TestProject manages the "virtual" test project directory structure and content

func NewTestProject Uses

func NewTestProject(t *testing.T, initPath, wd string, run RunFunc) *TestProject

NewTestProject initializes a new test's project directory.

func (*TestProject) Cleanup Uses

func (p *TestProject) Cleanup()

Cleanup (remove) the test project's directory.

func (*TestProject) CompareImportPaths Uses

func (p *TestProject) CompareImportPaths()

CompareImportPaths compares import paths before and after test commands.

func (*TestProject) CopyTree Uses

func (p *TestProject) CopyTree(src string)

CopyTree recursively copies a source directory into the test project's directory.

func (*TestProject) DoRun Uses

func (p *TestProject) DoRun(args []string) error

DoRun executes the integration test command against the test project.

func (*TestProject) GetImportPaths Uses

func (p *TestProject) GetImportPaths() []string

GetImportPaths collect final vendor paths at a depth of three levels.

func (*TestProject) GetStderr Uses

func (p *TestProject) GetStderr() string

GetStderr gets the Stderr output from test run.

func (*TestProject) GetStdout Uses

func (p *TestProject) GetStdout() string

GetStdout gets the Stdout output from test run.

func (*TestProject) GetVendorGit Uses

func (p *TestProject) GetVendorGit(ip string)

GetVendorGit populates the initial vendor directory for a test project.

func (*TestProject) GetVendorPaths Uses

func (p *TestProject) GetVendorPaths() []string

GetVendorPaths collects final vendor paths at a depth of three levels.

func (*TestProject) Must Uses

func (p *TestProject) Must(err error)

Must gives a fatal error if err is not nil.

func (*TestProject) Path Uses

func (p *TestProject) Path(args ...string) string

Path to the test project directory.

func (*TestProject) ProjPath Uses

func (p *TestProject) ProjPath(args ...string) string

ProjPath builds an import path for the test project.

func (*TestProject) RecordImportPaths Uses

func (p *TestProject) RecordImportPaths()

RecordImportPaths takes a snapshot of the import paths before test is run.

func (*TestProject) RunGit Uses

func (p *TestProject) RunGit(dir string, args ...string)

RunGit runs a git command, and expects it to succeed.

func (*TestProject) RunGo Uses

func (p *TestProject) RunGo(args ...string)

RunGo runs a go command, and expects it to succeed.

func (*TestProject) Setenv Uses

func (p *TestProject) Setenv(name, val string)

Setenv sets an environment variable to use when running the test go command.

func (*TestProject) TempDir Uses

func (p *TestProject) TempDir(args ...string)

TempDir creates a temporary directory for the test project.

func (*TestProject) TempProjDir Uses

func (p *TestProject) TempProjDir(args ...string)

TempProjDir builds the path to a package within the test project.

func (*TestProject) VendorPath Uses

func (p *TestProject) VendorPath(args ...string) string

VendorPath lists the contents of the test project's vendor directory.

Package integration imports 14 packages (graph). Updated 2018-09-02. Refresh now. Tools for package owners.