testutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 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

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

func AssertRuleFound

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

func AssertRuleNotFailed

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

func AssertRuleNotFound

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

func CopyDir

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

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

func CreateFS

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

func DecompressGzip

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

func DecompressSparseGzip

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

DecompressSparseGzip decompresses a sparse gzip file for virtual machine image.

func ImageName

func ImageName(subpath, tag, digest string) string

func MustMkdirAll

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

func MustReadJSON

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

func MustReadYAML

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

func MustWriteFile

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

func MustWriteJSON

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

func MustWriteYAML

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

func SetupLocalStack

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

func VMImageName

func VMImageName(subpath, tag, digest string) string

Types

type DockerClient

type DockerClient struct {
	*client.Client
}

func NewDockerClient

func NewDockerClient(t *testing.T) *DockerClient

func (*DockerClient) ImageLoad

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

func (*DockerClient) ImageRemove

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