test

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Test contains common test helpers used across packages in porter.

Index

Constants

View Source
const (
	MockedCommandEnv           = "MOCK_COMMAND"
	ExpectedCommandEnv         = "EXPECTED_COMMAND"
	ExpectedCommandExitCodeEnv = "EXPECTED_COMMAND_EXIT_CODE"
	ExpectedCommandErrorEnv    = "EXPECTED_COMMAND_STDERR"
	ExpectedCommandOutputEnv   = "EXPECTED_COMMAND_STDOUT"
)

Variables

This section is empty.

Functions

func CompareGoldenFile added in v1.0.1

func CompareGoldenFile(t *testing.T, goldenFile string, got string)

CompareGoldenFile checks if the specified string matches the content of a golden test file. When they are different and PORTER_UPDATE_TEST_FILES is true, the file is updated to match the new test output.

func TestMainWithMockedCommandHandlers

func TestMainWithMockedCommandHandlers(m *testing.M)

Types

type Logger

type Logger struct {
	T *testing.T
}

Logger helps capture output in a test while still showing it in the console

func (Logger) Write

func (l Logger) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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