tests

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

package tests provides helper functions and mocks for running tests

package tests provides helper functions and mocks for running tests

package tests provides helper functions and mocks for running tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertFileHasContent added in v0.7.0

func AssertFileHasContent(t *testing.T, filePath string)

func AssertFileHasExpectedLines added in v0.8.1

func AssertFileHasExpectedLines(t *testing.T, expectedLines []string, filePath string)

func ContainThisFileInTheGzip added in v0.4.0

func ContainThisFileInTheGzip(expectedFilePath string, actual interface{}) (success bool, err error)

func ExtractGZip added in v0.6.0

func ExtractGZip(t *testing.T, gzipArchive, fileName string) string

func ExtractGZipToTar added in v0.6.0

func ExtractGZipToTar(t *testing.T, gzipArchive string) string

func FindUniqueElements added in v0.7.0

func FindUniqueElements(array1, array2 []string) ([]string, []string)

func GzipContainsFile

func GzipContainsFile(t *testing.T, expectedFile, gzipArchive string)

func MatchFile added in v0.4.0

func MatchFile(expectedFile, actualFile string) (success bool, err error)

func MatchLines added in v0.8.1

func MatchLines(t *testing.T, expectedLines []string, actualFile string) (bool, error)

func PrintTree

func PrintTree(dir string, indent string)

PrintTree is a helper function to print directory structure recursively.

func TarContainsFile

func TarContainsFile(t *testing.T, expectedFile, archiveFile, internalPath string)

func TgzContainsFile

func TgzContainsFile(t *testing.T, expectedFile, archiveFile, internalPath string)

func Tree

func Tree(dir string)

Tree prints the directory structure in a tree-like format.

func TreeToString

func TreeToString(dir string) string

Types

type MockCli

type MockCli struct {
	Calls          [][]string
	StoredResponse []string
	StoredErrors   []error
}

func (*MockCli) Execute

func (m *MockCli) Execute(_ bool, args ...string) (out string, err error)

func (*MockCli) ExecuteAndStreamOutput

func (m *MockCli) ExecuteAndStreamOutput(_ bool, output cli.OutputHandler, args ...string) (err error)

Jump to

Keyboard shortcuts

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