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

testenv

package
v0.20.9 Latest Latest
Warning

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

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

Documentation

Overview

Package testenv boots an openrun server from the working tree for the browser-driven suites under tests/ui. Each test binary starts its own instance on its own ports in a temp OPENRUN_HOME. With GOCOVERDIR set the binary is built coverage-instrumented and the server writes its coverage data there, the CLI invocations to the sibling client directory, matching tests/run_cli_tests.sh so covtest merges all of it. OPENRUN_TEST_BIN names a prebuilt binary to use instead of building one.

Index

Constants

View Source
const AdminPass = "qwerty" // matches the bcrypt hash in the generated config

Variables

This section is empty.

Functions

func RepoRoot

func RepoRoot() string

RepoRoot returns the openrun repo root, derived from this file's location (tests/ui/testenv)

func TestappSource

func TestappSource() string

TestappSource is the standard test app (tests/testapp)

Types

type Env

type Env struct {
	Port     int
	RepoRoot string
	HomeDir  string
	BinPath  string
	// contains filtered or unexported fields
}

Env is a running openrun server

func Start

func Start(port int, opts Options) (*Env, error)

Start boots a fresh server on the port. The caller must call Stop

func (*Env) CLI

func (e *Env) CLI(args ...string) (string, error)

CLI runs the openrun CLI against the test server (over the unix socket)

func (*Env) CLIEnv

func (e *Env) CLIEnv() []string

CLIEnv is the environment for CLI invocations: like ServerEnv, with the client coverage data going to the sibling client directory of GOCOVERDIR (the run_cli_tests.sh convention) and the OS keyring off so stored logins land in the test home

func (*Env) ServerEnv

func (e *Env) ServerEnv() []string

ServerEnv is the process environment of the server: the test home and config, coverage data to GOCOVERDIR when set

func (*Env) Stop

func (e *Env) Stop()

Stop ends the server (gracefully, so coverage data is flushed) and removes the temp home (kept with OPENRUN_TEST_KEEP)

type Options

type Options struct {
	// HTTPSPort enables the HTTPS listener on that port (off by default)
	HTTPSPort int
	// SecurityExtra and SystemExtra are lines appended inside the [security]
	// and [system] tables; ExtraConfig is appended after them for further
	// tables ([api], [auth.*], ...)
	SecurityExtra string
	SystemExtra   string
	ExtraConfig   string
}

Options customize the generated openrun.toml. The base config sets the admin password (AdminPass) and the http port

Jump to

Keyboard shortcuts

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