testhelper

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2017 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestRelativePath    = "gitlab-test.git"
	RepositoryAuthToken = "the-secret-token"
)

TestRelativePath is the path inside its storage of the gitlab-test repo

Variables

This section is empty.

Functions

func AssertGrpcError added in v0.5.0

func AssertGrpcError(t *testing.T, err error, expectedCode codes.Code, containsText string)

AssertGrpcError asserts the passed err is of the same code as expectedCode. Optionally, it can assert the error contains the text of containsText if the latter is not an empty string.

func AuthorsEqual added in v0.15.0

func AuthorsEqual(a *pb.CommitAuthor, b *pb.CommitAuthor) bool

AuthorsEqual tests if two `CommitAuthor`s are equal

func ConfigureRuby added in v0.26.0

func ConfigureRuby()

ConfigureRuby configures Ruby settings for test purposes at run time.

func ConfigureTestStorage added in v0.48.0

func ConfigureTestStorage()

ConfigureTestStorage adds a storage entry to Config pointing to the path of the gitlab-test repo.

func Context added in v0.40.0

func Context() (context.Context, func())

Context returns a cancellable context.

func FindLocalBranchCommitAuthorsEqual added in v0.15.0

func FindLocalBranchCommitAuthorsEqual(a *pb.FindLocalBranchCommitAuthor, b *pb.FindLocalBranchCommitAuthor) bool

FindLocalBranchCommitAuthorsEqual tests if two `FindLocalBranchCommitAuthor`s are equal

func FindLocalBranchResponsesEqual added in v0.15.0

func FindLocalBranchResponsesEqual(a *pb.FindLocalBranchResponse, b *pb.FindLocalBranchResponse) bool

FindLocalBranchResponsesEqual tests if two `FindLocalBranchResponse`s are equal

func GetTemporaryGitalySocketFileName added in v0.24.0

func GetTemporaryGitalySocketFileName() string

GetTemporaryGitalySocketFileName will return a unique, useable socket file name

func GitCommitEqual added in v0.53.0

func GitCommitEqual(a, b *pb.GitCommit) error

GitCommitEqual tests if two `GitCommit`s are equal

func GitalyServersMetadata added in v0.56.0

func GitalyServersMetadata(t *testing.T, serverSocketPath string) metadata.MD

GitalyServersMetadata returns a metadata pair for gitaly-servers to be used in inter-gitaly operations.

func GitlabTestStoragePath added in v0.8.0

func GitlabTestStoragePath() string

GitlabTestStoragePath returns the storage path to the gitlab-test repo.

func MustHaveNoChildProcess added in v0.38.0

func MustHaveNoChildProcess()

MustHaveNoChildProcess panics if it finds a running or finished child process. It waits for 2 seconds for processes to be cleaned up by other goroutines.

func MustReadFile

func MustReadFile(t *testing.T, filename string) []byte

MustReadFile returns the content of a file or fails at once.

func MustRunCommand added in v0.5.0

func MustRunCommand(t *testing.T, stdin io.Reader, name string, args ...string) []byte

MustRunCommand runs a command with an optional standard input and returns the standard output, or fails.

func NewTestGrpcServer added in v0.30.0

func NewTestGrpcServer(t *testing.T, streamInterceptors []grpc.StreamServerInterceptor, unaryInterceptors []grpc.UnaryServerInterceptor) *grpc.Server

NewTestGrpcServer creates a GRPC Server for testing purposes

func NewTestLogger added in v0.30.0

func NewTestLogger(t *testing.T) *log.Logger

NewTestLogger created a logrus hook which can be used with testing logs

func NewTestRepo added in v0.56.0

func NewTestRepo(t *testing.T) (repo *pb.Repository, repoPath string, cleanup func())

NewTestRepo creates a bare copy of the test repository.

func NewTestRepoWithWorktree added in v0.56.0

func NewTestRepoWithWorktree(t *testing.T) (repo *pb.Repository, repoPath string, cleanup func())

NewTestRepoWithWorktree creates a copy of the test repository with a worktree. This is allows you to run normal 'non-bare' Git commands.

func TestRepository added in v0.12.0

func TestRepository() *pb.Repository

TestRepository returns the `Repository` object for the gitlab-test repo. Tests should be calling this function instead of cloning the repo themselves. Tests that involve modifications to the repo should copy/clone the repo via the `Repository` returned from this function.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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