integration

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package integration provides integration test utilities and fixtures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequireGitVersion

func RequireGitVersion(t testing.TB, minVersion string)

RequireGitVersion checks if git is installed and meets the minimum version.

Types

type TestRepo

type TestRepo struct {
	Dir string
	// contains filtered or unexported fields
}

TestRepo represents a temporary git repository for testing.

func NewTestRepo

func NewTestRepo(t testing.TB) *TestRepo

NewTestRepo creates a new temporary git repository for testing. The repository is automatically cleaned up when the test completes.

func (*TestRepo) AnnotatedTag

func (r *TestRepo) AnnotatedTag(name, message string)

AnnotatedTag creates an annotated tag at the current HEAD.

func (*TestRepo) Branch

func (r *TestRepo) Branch(name string)

Branch creates and switches to a new branch.

func (*TestRepo) Checkout

func (r *TestRepo) Checkout(ref string)

Checkout switches to a branch or commit.

func (*TestRepo) Commit

func (r *TestRepo) Commit(message string) string

Commit stages all changes and creates a commit.

func (*TestRepo) CommitWithDate

func (r *TestRepo) CommitWithDate(message string, date time.Time) string

CommitWithDate creates a commit with a specific date.

func (*TestRepo) CurrentBranch

func (r *TestRepo) CurrentBranch() string

CurrentBranch returns the current branch name.

func (*TestRepo) Git

func (r *TestRepo) Git(args ...string) string

Git runs a git command in the test repository.

func (*TestRepo) GitMayFail

func (r *TestRepo) GitMayFail(args ...string) (string, error)

GitMayFail runs a git command that may fail, returning the output and error.

func (*TestRepo) HeadHash

func (r *TestRepo) HeadHash() string

HeadHash returns the current HEAD commit hash.

func (*TestRepo) Path

func (r *TestRepo) Path(relPath string) string

Path returns the full path to a file in the repository.

func (*TestRepo) SetupBreakingChangeCommits

func (r *TestRepo) SetupBreakingChangeCommits()

SetupBreakingChangeCommits creates commits with breaking changes.

func (*TestRepo) SetupConventionalCommits

func (r *TestRepo) SetupConventionalCommits()

SetupConventionalCommits creates a series of conventional commits for testing.

func (*TestRepo) SetupVersionedTags

func (r *TestRepo) SetupVersionedTags()

SetupVersionedTags creates tags with semantic versions.

func (*TestRepo) Tag

func (r *TestRepo) Tag(name string)

Tag creates a lightweight tag at the current HEAD.

func (*TestRepo) WriteFile

func (r *TestRepo) WriteFile(path, content string)

WriteFile writes a file to the repository.

Jump to

Keyboard shortcuts

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