testhelpers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package testhelpers provide helpers for writing probe provider tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEquivalent

func AssertEquivalent(got, expected model.Statuses, t *testing.T)

AssertEquivalent runs Equivalent and fails the provided test if it returns false

func ConfigureProbe

func ConfigureProbe(t *testing.T, cfgCtx *hcl.EvalContext, cfgWriter func(*hclwrite.Body), provide model.ProbeProvider) model.Prober

ConfigureProbe will configure and return an instance of the provided ProbeProvider after applying the provided configuration writer function.

func Equivalent

func Equivalent(got, expected model.Statuses) (errs map[string][]string, err error)

Equivalent compares two Statuses ignoring label, times and ordering. Useful for Probe test purposes where time may not be reproducible. If expected Description is empty, then Description is ignored

Types

type TestConfig

type TestConfig struct {
	Config hcl.Body `hcl:"probe_configuration,remain"`
}

TestConfig is used to decode HCL for test purposes.

Jump to

Keyboard shortcuts

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