testutil

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist string = lo.Ternary(runtime.GOOS == "windows",
	"The system cannot find the file specified.",
	"no such file or directory")

Functions

func AssertDefsecEqual added in v0.50.0

func AssertDefsecEqual(t *testing.T, expected, actual any)

func AssertRuleFound added in v0.50.0

func AssertRuleFound(t *testing.T, ruleID string, results scan.Results, message string, args ...any)

func AssertRuleNotFailed added in v0.58.0

func AssertRuleNotFailed(t *testing.T, ruleID string, results scan.Results, message string, args ...any)

func AssertRuleNotFound added in v0.50.0

func AssertRuleNotFound(t *testing.T, ruleID string, results scan.Results, message string, args ...any)

func CopyDir added in v0.53.0

func CopyDir(t *testing.T, src, dst string)

CopyDir copies the directory content from src to dst. It supports only simple cases for testing.

func CopyFile added in v0.54.0

func CopyFile(t *testing.T, src, dst string)

func CreateFS added in v0.50.0

func CreateFS(t *testing.T, files map[string]string) fs.FS

func DecompressGzip

func DecompressGzip(t *testing.T, src, dst string)

func DecompressSparseGzip added in v0.43.0

func DecompressSparseGzip(t *testing.T, src, dst string)

DecompressSparseGzip decompresses a sparse gzip file for virtual machine image.

func ImageName added in v0.57.0

func ImageName(subpath, tag, digest string) string

func MustMkdirAll added in v0.54.0

func MustMkdirAll(t *testing.T, dir string)

func MustReadJSON added in v0.54.0

func MustReadJSON(t *testing.T, filePath string, v any)

func MustReadYAML added in v0.54.0

func MustReadYAML(t *testing.T, path string, out any)

func MustWriteFile added in v0.54.0

func MustWriteFile(t *testing.T, filePath string, content []byte)

func MustWriteJSON added in v0.54.0

func MustWriteJSON(t *testing.T, filePath string, v any)

func MustWriteYAML added in v0.54.0

func MustWriteYAML(t *testing.T, path string, data any)

func SetupLocalStack added in v0.50.0

func SetupLocalStack(ctx context.Context, version string) (*localstack.LocalStackContainer, string, error)

func VMImageName added in v0.57.0

func VMImageName(subpath, tag, digest string) string

Types

type DockerClient added in v0.56.0

type DockerClient struct {
	*client.Client
}

func NewDockerClient added in v0.56.0

func NewDockerClient(t *testing.T) *DockerClient

func (*DockerClient) ImageLoad added in v0.56.0

func (c *DockerClient) ImageLoad(t *testing.T, ctx context.Context, imageFile string) string

func (*DockerClient) ImageRemove added in v0.56.0

func (c *DockerClient) ImageRemove(t *testing.T, ctx context.Context, imageID string)

Jump to

Keyboard shortcuts

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