testlib

package
v1.21.95 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package testlib contains test helpers for goreleaser tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertSkipped

func AssertSkipped(t *testing.T, err error)

AssertSkipped asserts that a pipe was skipped.

func CatFileFromBareRepository

func CatFileFromBareRepository(tb testing.TB, url, name string) []byte

func CatFileFromBareRepositoryOnBranch added in v1.21.90

func CatFileFromBareRepositoryOnBranch(tb testing.TB, url, branch, name string) []byte

func CheckPath

func CheckPath(tb testing.TB, cmd string)

CheckPath skips the test if the binary is not in the PATH.

func GetFileFromArchive

func GetFileFromArchive(tb testing.TB, path, format, filename string) []byte

GetFileFromArchive returns the contents of filename inside the given archive path.

func GitAdd

func GitAdd(tb testing.TB)

GitAdd adds all files to stage.

func GitAnnotatedTag

func GitAnnotatedTag(tb testing.TB, tag, message string)

GitAnnotatedTag creates an annotated tag.

func GitBranch

func GitBranch(tb testing.TB, branch string)

GitBranch creates a git branch.

func GitCheckoutBranch

func GitCheckoutBranch(tb testing.TB, name string)

GitCheckoutBranch allows us to change the active branch that we're using.

func GitCommit

func GitCommit(tb testing.TB, msg string)

GitCommit creates a git commits.

func GitInit

func GitInit(tb testing.TB)

GitInit inits a new git project.

func GitMakeBareRepository

func GitMakeBareRepository(tb testing.TB) string

func GitRemoteAdd

func GitRemoteAdd(tb testing.TB, url string)

GitRemoteAdd adds the given url as remote.

func GitRemoteAddWithName

func GitRemoteAddWithName(tb testing.TB, remote, url string)

GitRemoteAddWithName adds the given url as remote with given name.

func GitTag

func GitTag(tb testing.TB, tag string)

GitTag creates a git tag.

func LsArchive

func LsArchive(tb testing.TB, path, format string) []string

LsArchive return the file list of a given archive in a given formatkj

func MakeNewSSHKey

func MakeNewSSHKey(tb testing.TB, pass string) string

func MakeNewSSHKeyType added in v1.21.90

func MakeNewSSHKeyType(tb testing.TB, pass string, algo keygen.KeyType) string

func Mktmp

func Mktmp(tb testing.TB) string

Mktmp creates a new tempdir, cd into it and provides a back function that cd into the previous directory.

func MustDockerPool

func MustDockerPool(f Fataler) *dockertest.Pool

MustDockerPool gets a single dockertet.Pool.

func MustKillContainer

func MustKillContainer(f Fataler, name string)

MustKillContainer kills the given container by name if it exists in the current dockertest.Pool.

func RequireTemplateError

func RequireTemplateError(tb testing.TB, err error)

RequireTemplateError requires thqt an error happens and that it is a template error.

func StartRegistry

func StartRegistry(tb testing.TB, name, port string)

StartRegistry starts a registry with the given name in the given port, and sets up its deletion on test.Cleanup.

Types

type Fataler

type Fataler interface {
	Fatal(args ...any)
}

Fataler interface, can be a log.Default() or testing.TB, for example.

Jump to

Keyboard shortcuts

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