Help us shape the future of Go! Take the 2026 Go Developer Survey

testenv

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package testenv starts in-process protocol servers for tests: an S3 fake over HTTP and an SSH server with a read-only SFTP subsystem. Synthetic data only; nothing here is used outside tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPlugin

func BuildPlugin(t testing.TB, name string) []byte

BuildPlugin builds sandbox/testdata/plugins/<name> once per test binary.

func ClientKey

func ClientKey(t testing.TB, passphrase []byte) ([]byte, ssh.PublicKey)

ClientKey generates an ed25519 client key: its OpenSSH PEM, encrypted with passphrase when not empty, and its public key.

func Install

func Install(t testing.TB, s plugin.Store, qualified string, bin []byte, question string, timeoutS int) plugin.LockEntry

Install installs bin as the plugin qualified (marketplace/name, or a bare name for the official marketplace) at version 1.0.0.

func Manifest

func Manifest(name, question string, timeoutS int) []byte

Manifest is a valid manifest for a test plugin.

func RepoRoot

func RepoRoot() string

RepoRoot is the lockfile repository root.

func TempStore

func TempStore(t testing.TB) plugin.Store

TempStore is a plugin store the test can remove although installed plugin directories are read-only (0500).

Types

type S3

type S3 struct {
	Endpoint string
	Bucket   string
	// contains filtered or unexported fields
}

S3 is a running S3 fake with one bucket.

func NewS3

func NewS3(t testing.TB, bucket string) *S3

NewS3 starts an S3 fake with bucket.

func (*S3) Put

func (s *S3) Put(t testing.TB, key string, body []byte)

Put stores body at key.

type SFTP

type SFTP struct {
	Host       string
	Port       int
	User       string
	KnownHosts string // a known_hosts file holding the server's key
}

SFTP is a running SFTP server.

func NewSFTP

func NewSFTP(t testing.TB, root string, o SFTPOptions) *SFTP

NewSFTP serves root read-only over SFTP.

type SFTPOptions

type SFTPOptions struct {
	User          string
	Password      string
	AuthorizedKey ssh.PublicKey
}

SFTPOptions are the accepted logins: a password, an authorized key, or both.

Directories

Path Synopsis
Package consoletest runs a real lockfile console in the test process: lockkit's console.Run on lockfile's backend, a local source, plugins built from sandbox/testdata, a scripted human and a real socket in the test's private runtime directory.
Package consoletest runs a real lockfile console in the test process: lockkit's console.Run on lockfile's backend, a local source, plugins built from sandbox/testdata, a scripted human and a real socket in the test's private runtime directory.

Jump to

Keyboard shortcuts

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