package testhelpers

import "github.com/hashicorp/vault/sdk/helper/testhelpers"

Index

Functions

func StringOrDie

func StringOrDie(t testing.TB, in any) string

StringOrDie renders its input using ToMap, and returns a string containing the result. If rendering yields an error, calls t.Fatal.

func ToMap

func ToMap(in any) (map[string]any, error)

ToMap renders an input value of any type as a map. This is intended for logging human-readable data dumps in test logs, so it uses the `json` tags on struct fields: this makes it easy to exclude `"-"` values that are typically not interesting, respect omitempty, etc.

We also replace any []byte fields with a hash of their value. This is usually sufficient for test log purposes, and is a lot more readable than a big array of individual byte values like Go would normally stringify a byte slice.

func ToString

func ToString(in any) string

ToString renders its input using ToMap, and returns a string containing the result or an error if that fails.

Source Files

output.go

Directories

PathSynopsis
helper/testhelpers/namespaces
helper/testhelpers/schema
helper/testhelpers/snapshots
Version
v0.18.0 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
1 month ago

Tools for package owners.