Documentation ¶
Index ¶
- Constants
- func AddWorktree(t *testing.T, repoPath string, worktreeName string)
- func AssertFileNotExists(t *testing.T, path string)
- func AuthorsEqual(a *gitalypb.CommitAuthor, b *gitalypb.CommitAuthor) bool
- func CaptureHookEnv(t *testing.T) (hookPath string, cleanup func())
- func ConfigureGitalySSH()
- func ConfigureRuby()
- func Context() (context.Context, func())
- func CreateCommit(t *testing.T, repoPath, branchName string, opts *CreateCommitOpts) string
- func CreateCommitInAlternateObjectDirectory(t *testing.T, repoPath, altObjectsDir string, cmd *exec.Cmd) (currentHead []byte)
- func CreateRemoteBranch(t *testing.T, repoPath, remoteName, branchName, ref string)
- func CreateRepo(t *testing.T, storagePath string) (repo *gitalypb.Repository, repoPath, relativePath string)
- func CreateTag(t *testing.T, repoPath, tagName, targetID string, opts *CreateTagOpts) string
- func EnableGitProtocolV2Support() func()
- func FindLocalBranchCommitAuthorsEqual(a *gitalypb.FindLocalBranchCommitAuthor, ...) bool
- func FindLocalBranchResponsesEqual(a *gitalypb.FindLocalBranchResponse, b *gitalypb.FindLocalBranchResponse) bool
- func GetGitEnvData() (string, error)
- func GetRepositoryRefs(t *testing.T, repoPath string) string
- func GetTemporaryGitalySocketFileName() string
- func GitCommitEqual(a, b *gitalypb.GitCommit) error
- func GitalyServersMetadata(t *testing.T, serverSocketPath string) metadata.MD
- func GitlabTestStoragePath() string
- func InitBareRepo(t *testing.T) (*gitalypb.Repository, string, func())
- func InitRepoWithWorktree(t *testing.T) (*gitalypb.Repository, string, func())
- func MustHaveNoChildProcess()
- func MustReadFile(t *testing.T, filename string) []byte
- func MustRunCommand(t *testing.T, stdin io.Reader, name string, args ...string) []byte
- func NewTestGrpcServer(t *testing.T, streamInterceptors []grpc.StreamServerInterceptor, ...) *grpc.Server
- func NewTestLogger(t *testing.T) *log.Logger
- func NewTestRepo(t *testing.T) (repo *gitalypb.Repository, repoPath string, cleanup func())
- func NewTestRepoWithWorktree(t *testing.T) (repo *gitalypb.Repository, repoPath string, cleanup func())
- func RequireGrpcError(t *testing.T, err error, expectedCode codes.Code)
- func TestRepository() *gitalypb.Repository
- type CreateCommitOpts
- type CreateTagOpts
Constants ¶
const ( TestRelativePath = "gitlab-test.git" RepositoryAuthToken = "the-secret-token" DefaultStorageName = "default" )
TestRelativePath is the path inside its storage of the gitlab-test repo
Variables ¶
This section is empty.
Functions ¶
func AddWorktree ¶ added in v0.90.0
AddWorktree creates a worktree in the repository path for tests
func AssertFileNotExists ¶ added in v0.90.0
AssertFileNotExists asserts true if the file doesn't exist, false otherwise
func AuthorsEqual ¶ added in v0.15.0
func AuthorsEqual(a *gitalypb.CommitAuthor, b *gitalypb.CommitAuthor) bool
AuthorsEqual tests if two `CommitAuthor`s are equal
func CaptureHookEnv ¶ added in v1.13.0
CaptureHookEnv creates a bogus 'update' Git hook to sniff out what environment variables get set for hooks.
func ConfigureGitalySSH ¶ added in v0.66.0
func ConfigureGitalySSH()
ConfigureGitalySSH configures the gitaly-ssh command for tests
func ConfigureRuby ¶ added in v0.26.0
func ConfigureRuby()
ConfigureRuby configures Ruby settings for test purposes at run time.
func CreateCommit ¶ added in v0.63.0
func CreateCommit(t *testing.T, repoPath, branchName string, opts *CreateCommitOpts) string
CreateCommit makes a new empty commit and updates the named branch to point to it.
func CreateCommitInAlternateObjectDirectory ¶ added in v0.86.0
func CreateCommitInAlternateObjectDirectory(t *testing.T, repoPath, altObjectsDir string, cmd *exec.Cmd) (currentHead []byte)
CreateCommitInAlternateObjectDirectory runs a command such that its created objects will live in an alternate objects directory. It returns the current head after the command is run and the alternate objects directory path
func CreateRemoteBranch ¶ added in v0.113.0
CreateRemoteBranch creates a new remote branch
func CreateRepo ¶ added in v1.26.0
func CreateRepo(t *testing.T, storagePath string) (repo *gitalypb.Repository, repoPath, relativePath string)
CreateRepo creates an temporary directory for a repo, without initializing it
func CreateTag ¶ added in v0.93.0
func CreateTag(t *testing.T, repoPath, tagName, targetID string, opts *CreateTagOpts) string
CreateTag creates a new tag.
func EnableGitProtocolV2Support ¶ added in v0.129.1
func EnableGitProtocolV2Support() func()
EnableGitProtocolV2Support ensures that Git protocol v2 support is enabled, and replaces the git binary in config with an `env_git` wrapper that allows the protocol to be tested. It returns a function that restores the given settings.
Because we don't know how to get to that wrapper script from the current working directory, callers must create a symbolic link to the `env_git` file in their own `testdata` directories.
func FindLocalBranchCommitAuthorsEqual ¶ added in v0.15.0
func FindLocalBranchCommitAuthorsEqual(a *gitalypb.FindLocalBranchCommitAuthor, b *gitalypb.FindLocalBranchCommitAuthor) bool
FindLocalBranchCommitAuthorsEqual tests if two `FindLocalBranchCommitAuthor`s are equal
func FindLocalBranchResponsesEqual ¶ added in v0.15.0
func FindLocalBranchResponsesEqual(a *gitalypb.FindLocalBranchResponse, b *gitalypb.FindLocalBranchResponse) bool
FindLocalBranchResponsesEqual tests if two `FindLocalBranchResponse`s are equal
func GetGitEnvData ¶ added in v0.125.0
GetGitEnvData reads and returns the content of testGitEnv
func GetRepositoryRefs ¶ added in v0.66.0
GetRepositoryRefs gives a list of each repository ref as a string
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
GitCommitEqual tests if two `GitCommit`s are equal
func GitalyServersMetadata ¶ added in v0.56.0
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 InitBareRepo ¶ added in v0.72.0
func InitBareRepo(t *testing.T) (*gitalypb.Repository, string, func())
InitBareRepo creates a new bare repository
func InitRepoWithWorktree ¶ added in v0.88.0
func InitRepoWithWorktree(t *testing.T) (*gitalypb.Repository, string, func())
InitRepoWithWorktree creates a new repository with a worktree
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 ¶
MustReadFile returns the content of a file or fails at once.
func MustRunCommand ¶ added in v0.5.0
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
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 *gitalypb.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 *gitalypb.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 RequireGrpcError ¶ added in v0.106.0
RequireGrpcError asserts the passed err is of the same code as expectedCode.
func TestRepository ¶ added in v0.12.0
func TestRepository() *gitalypb.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 ¶
type CreateCommitOpts ¶ added in v0.93.0
CreateCommitOpts holds extra options for CreateCommit.
type CreateTagOpts ¶ added in v0.93.0
type CreateTagOpts struct {
Message string
}
CreateTagOpts holds extra options for CreateTag.