Documentation ¶
Overview ¶
package test contains helpers for writing tests
Index ¶
- Variables
- func ExecError(err error) error
- func HasCluster() error
- func JSONPretty(v any) string
- func JSONString(v any) string
- func ListenPort() (int, error)
- func Must[T any](v T, err error) T
- func PanicErr(err error)
- func SkipIfNoCluster(t *testing.T)
- func SkipIfNoCommand(t *testing.T, cmd string)
- func TempNamespace(t *testing.T, c client.Client) string
- func Watch(t *testing.T, w watch.Interface, timeout time.Duration, ...)
- type LokiServer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func HasCluster ¶
func HasCluster() error
func JSONPretty ¶
JSONPretty returns an indented JSON string, or error message if marshal fails.
func JSONString ¶
JSONString returns the JSON marshaled string from v, or the error message if marshal fails
func ListenPort ¶
ListenPort returns a free ephemeral port for listening.
func SkipIfNoCluster ¶
SkipIfNoCluster calls t.Skip if no cluster is detected.
func SkipIfNoCommand ¶
SkipIfNoCommand skips a test if the cmd is not found in PATH
func TempNamespace ¶
TempNamespace creates a unique namespace.
Types ¶
type LokiServer ¶
LokiServer is a single-process Loki instance running in a container.
func NewLokiServer ¶
func NewLokiServer() (server *LokiServer, err error)
func RequireLokiServer ¶
func RequireLokiServer(t *testing.T) *LokiServer
func (*LokiServer) Close ¶
func (s *LokiServer) Close() error
func (*LokiServer) Push ¶
func (s *LokiServer) Push(labels map[string]string, lines ...string) error
func (*LokiServer) URL ¶
func (s *LokiServer) URL() *url.URL
Click to show internal directories.
Click to hide internal directories.