e2e

package
v1.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGitServerImageName

func GetGitServerImageName(t *testing.T) string

func IsPorchServerRunningInCluster

func IsPorchServerRunningInCluster(t *testing.T) bool

func KubectlApply

func KubectlApply(t *testing.T, config string)

func KubectlCreateNamespace

func KubectlCreateNamespace(t *testing.T, name string)

func KubectlDeleteNamespace

func KubectlDeleteNamespace(t *testing.T, name string)

func KubectlWaitForDeployment

func KubectlWaitForDeployment(t *testing.T, namespace, name string)

func KubectlWaitForLoadBalancerIp

func KubectlWaitForLoadBalancerIp(t *testing.T, namespace, name string) string

func KubectlWaitForService

func KubectlWaitForService(t *testing.T, namespace, name string)

func RemovePackagerevFinalizers

func RemovePackagerevFinalizers(t *testing.T, namespace string)

func WriteTestCaseConfig

func WriteTestCaseConfig(t *testing.T, tc *TestCaseConfig)

Types

type CliTestSuite added in v1.3.1

type CliTestSuite struct {
	// The path of the directory containing the test cases.
	TestDataPath string
	// SearchAndReplace contains (search, replace) pairs that will be applied to the command output before comparison.
	SearchAndReplace map[string]string
	// GitServerURL is the URL of the git server to use for the tests.
	GitServerURL string
	// PorchctlCommand is the full path to the porchctl command to be tested.
	PorchctlCommand string
}

func NewCliTestSuite added in v1.3.1

func NewCliTestSuite(t *testing.T, testdataDir string) *CliTestSuite

NewCliTestSuite creates a new CliTestSuite based on the configuration in the testdata directory.

func (*CliTestSuite) KubectlWaitForGitDNS added in v1.3.1

func (s *CliTestSuite) KubectlWaitForGitDNS(t *testing.T)

Kubernetes DNS needs time to propagate the git server's domain name. Wait until we can register the repository and list its contents.

func (*CliTestSuite) Porchctl added in v1.3.1

func (s *CliTestSuite) Porchctl(t *testing.T, args ...string) error

Porchctl runs the porchctl command under test with the given arguments.

func (*CliTestSuite) RegisterRepository added in v1.3.1

func (s *CliTestSuite) RegisterRepository(t *testing.T, repoURL, namespace, name string)

func (*CliTestSuite) RunTestCase added in v1.3.1

func (s *CliTestSuite) RunTestCase(t *testing.T, tc TestCaseConfig)

RunTestCase runs a single test case.

func (*CliTestSuite) RunTests added in v1.3.1

func (s *CliTestSuite) RunTests(t *testing.T)

RunTests runs the test cases in the testdata directory.

func (*CliTestSuite) ScanTestCases added in v1.3.1

func (s *CliTestSuite) ScanTestCases(t *testing.T) []TestCaseConfig

ScanTestCases parses the test case configs from the testdata directory.

func (*CliTestSuite) StartGitServer added in v1.3.1

func (s *CliTestSuite) StartGitServer(t *testing.T)

type Command

type Command struct {
	// Args is a list of args for the kpt CLI.
	Args []string `yaml:"args,omitempty"`
	// StdIn contents will be passed as the command's standard input, if not empty.
	Stdin string `yaml:"stdin,omitempty"`
	// StdOut is the standard output expected from the command.
	Stdout string `yaml:"stdout,omitempty"`
	// StdErr is the standard error output expected from the command.
	Stderr string `yaml:"stderr,omitempty"`
	// ExitCode is the expected exit code frm the command.
	ExitCode int `yaml:"exitCode,omitempty"`
	// Yaml indicates that stdout is yaml and the test will reformat it for stable ordering
	Yaml bool `yaml:"yaml,omitempty"`
	// IgnoreWhitespace indicates that whitespace differences should be ignored in the output
	IgnoreWhitespace bool `yaml:"ignoreWhitespace,omitempty"`
}

type TestCaseConfig

type TestCaseConfig struct {
	// TestCase is the name of the test case.
	TestCase string `yaml:"-"`
	// ConfigFile stores the name of the config file from which the config was loaded.
	// Used when generating or updating golden files.
	ConfigFile string `yaml:"-"`
	// Repository is the name of the k8s Repository resource to register the default Git repo.
	Repository string `yaml:"repository,omitempty"`
	// Commands is a list of porchctl commands to be executed by the test.
	Commands []Command `yaml:"commands,omitempty"`
	// Skip the test? If the value is not empty, it will be used as a message with which to skip the test.
	Skip string `yaml:"skip,omitempty"`
}

func ReadTestCaseConfig

func ReadTestCaseConfig(t *testing.T, name, path string) TestCaseConfig

Jump to

Keyboard shortcuts

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