dockertest

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dockertest holds test helpers shared by every package whose _live_test.go files need a real Docker daemon (or other real, network-dependent infra) to run.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Gitea is the official rootless Gitea image.
	Gitea = ForgeKind{Name: "gitea", Image: "gitea/gitea:1.22-rootless", Binary: "gitea", EnvPrefix: "GITEA__"}
	// Forgejo is the official rootless Forgejo image.
	Forgejo = ForgeKind{Name: "forgejo", Image: "codeberg.org/forgejo/forgejo:11-rootless", Binary: "forgejo", EnvPrefix: "FORGEJO__"}
)

Functions

func SkipIfShort

func SkipIfShort(t *testing.T)

SkipIfShort skips t in short mode; the full, no-short run lives in nightly.yml.

Types

type Forge

type Forge struct {
	Kind     ForgeKind
	URL      string
	Admin    string
	Password string
	// Token is an admin access token with every scope; never log it.
	Token string
	// contains filtered or unexported fields
}

Forge is one running throwaway forge container.

func StartForge

func StartForge(t *testing.T, kind ForgeKind) *Forge

StartForge runs a forge on a random loopback port with no volumes, creates an admin user and token through the container's own CLI, and removes the container when the test ends. Images stay for the caller to remove.

type ForgeKind

type ForgeKind struct {
	Name   string
	Image  string
	Binary string
	// EnvPrefix is the app.ini override prefix the image understands.
	EnvPrefix string
}

ForgeKind selects which self-hosted forge StartForge runs.

Jump to

Keyboard shortcuts

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