configtest

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package configtest provides config-singleton setup helpers for tests. Kept separate from internal/testutil to avoid an import cycle: testutil is imported by config's own internal test suite, but this helper depends on internal/config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(overrides ...map[string]any) *config.Config

Setup seeds the process-wide config singleton with defaults plus any caller-supplied overrides, registers a DeferCleanup to reset the singleton, and returns the resulting *config.Config.

The data_dir key is automatically pointed at a Ginkgo-managed temp directory because config validation requires it to exist on disk. Overrides merge on top of defaults + the tmp data_dir — they use the same nested map shape as the YAML config file.

Intended for use in BeforeEach or BeforeSuite:

BeforeEach(func() { configtest.Setup(map[string]any{
    "auth": map[string]any{
        "session_secret": "test-secret",
        "session_ttl":    "1h",
    },
}) })

func SetupFile

func SetupFile(overrides ...map[string]any) *config.Config

SetupFile mirrors Setup but writes a YAML file to a temp dir and calls config.Load(path), so config.Update has a backing file to write back to. Use only when the test exercises mutation paths (Update / AddOIDCProvider); prefer Setup otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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