testenv

package
v0.0.0-...-c827789 Latest Latest
Warning

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

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

Documentation

Overview

Package testenv provides real infrastructure for integration tests (build tag `integration`, spec 14 §1).

PostgreSQL and NATS come from QS_TEST_PG_DSN and QS_TEST_NATS_URL when set (the DevSpace dev pod points them at servers in the dev namespace); otherwise containers are started once per test binary with testcontainers (CI, machines with Docker).

Index

Constants

View Source
const NATSURLEnv = "QS_TEST_NATS_URL"

NATSURLEnv names the variable with the URL of an existing NATS server with JetStream enabled.

View Source
const PostgresDSNEnv = "QS_TEST_PG_DSN"

PostgresDSNEnv names the variable with an admin DSN (URL form) of an existing server; the role must be allowed to create databases.

Variables

This section is empty.

Functions

func NATS

func NATS(t testing.TB) string

NATS returns the URL of a NATS server with JetStream. The server is shared: tests isolate themselves with unique stream and subject names (Name).

func Name

func Name(prefix string) string

Name returns prefix followed by a random suffix, usable as a NATS subject token or stream name.

func Postgres

func Postgres(t testing.TB) string

Postgres returns the DSN of a new, empty database that is dropped when the test ends. Each call gets its own database, so tests may run in parallel.

Types

This section is empty.

Jump to

Keyboard shortcuts

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