testutil

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlpineImage added in v0.0.3

func AlpineImage(t *testing.T) string

AlpineImage returns the Alpine image reference from docker/server.Dockerfile. This is the version we ship with, so integration tests should use it.

func ComposeServiceImage added in v0.0.3

func ComposeServiceImage(composeFile, service string) string

ComposeServiceImage extracts the image for a named service from a docker-compose file, relative to the repo root. Panics on error so it can be used in TestMain and package-level vars.

func MakeBundle

func MakeBundle(t *testing.T) []byte

MakeBundle returns a valid tar.gz containing app.R and a DESCRIPTION file. The DESCRIPTION makes the bundle deployable without bare-script preprocessing.

func MakeBundleWithoutEntrypoint

func MakeBundleWithoutEntrypoint(t *testing.T) []byte

MakeBundleWithoutEntrypoint returns a valid tar.gz that has no app.R.

func MakeTraversalBundle

func MakeTraversalBundle(t *testing.T) []byte

MakeTraversalBundle returns a tar.gz with a path traversal entry.

func TOMLDockerImage added in v0.0.3

func TOMLDockerImage(t *testing.T) string

TOMLDockerImage reads the docker.image field from a blockyard.toml file, relative to the repo root.

Types

type MockIdP added in v0.0.2

type MockIdP struct {
	Server *httptest.Server

	// Sub and Groups to include in issued ID tokens.
	Sub    string
	Groups []string

	// Nonce to embed in the next ID token. Tests should set this to the
	// nonce extracted from the login redirect URL before calling /callback.
	Nonce string
	// contains filtered or unexported fields
}

MockIdP is a minimal OIDC-compliant mock identity provider for integration tests. Serves:

GET  /.well-known/openid-configuration
GET  /jwks
POST /token

func NewMockIdP added in v0.0.2

func NewMockIdP() *MockIdP

NewMockIdP starts a mock IdP on a random port. The default sub is "test-sub" with groups ["testers"].

func (*MockIdP) Close added in v0.0.2

func (m *MockIdP) Close()

func (*MockIdP) IssueJWT added in v0.0.2

func (m *MockIdP) IssueJWT(sub string, groups []string) string

IssueJWT creates a JWT for control-plane Bearer auth (client credentials style). Same signing key as ID tokens, different claims structure.

func (*MockIdP) IssuerURL added in v0.0.2

func (m *MockIdP) IssuerURL() string

func (*MockIdP) Kid added in v0.0.2

func (m *MockIdP) Kid() string

Kid returns the key ID used in the JWKS.

func (*MockIdP) PrivateKey added in v0.0.2

func (m *MockIdP) PrivateKey() *rsa.PrivateKey

PrivateKey returns the RSA private key used for signing.

Jump to

Keyboard shortcuts

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