Documentation ¶
Index ¶
- Constants
- func PreserveTags(opts *TestBundleOptions)
- type TestBundleOptions
- type TestRegistry
- type TestRegistryOptions
- type Tester
- func (t Tester) ApplyTestBundlePrerequisites()
- func (t Tester) Chdir(dir string)
- func (t Tester) Close()
- func (t Tester) CurrentNamespace() string
- func (t Tester) EditYaml(path string, transformations ...func(yq *yaml.Editor) error)
- func (t Tester) ListInstallations(allNamespaces bool, namespace string, name string, labels []string) ([]porter.DisplayInstallation, error)
- func (t Tester) MakeTestBundle(name string, ref string, options ...func(*TestBundleOptions))
- func (t Tester) PrepareTestBundle()
- func (t *Tester) RequireFileMode(path string, mode os.FileMode)
- func (t Tester) RequireInstallationExists(namespace string, name string) porter.DisplayInstallation
- func (t Tester) RequireInstallationInList(namespace, name string, list []storage.Installation) storage.Installation
- func (t Tester) RequireInstallationNotFound(namespace string, name string)
- func (t Tester) RequireNotFoundReturned(err error)
- func (t Tester) RequirePorter(args ...string) (stdout string, combinedoutput string)
- func (t Tester) RunPorter(args ...string) (stdout string, combinedoutput string, err error)
- func (t Tester) RunPorterWith(opts ...func(*shx.PreparedCommand)) (stdout string, combinedoutput string, err error)
- func (t Tester) ShowInstallation(namespace string, name string) (porter.DisplayInstallation, error)
- func (t Tester) StartTestRegistry(opts TestRegistryOptions) *TestRegistry
Constants ¶
const TestRegistryAlias = "PORTER_TEST_REGISTRY_ALIAS"
TestRegistryAlias is the environment variable that contains a pre-configured hostname alias that can be used to access localhost. This environment variable is only set in on the linux and macos CI agents so that we can test a variant of communicating with a registry that is unsecured but is not obviously "localhost" or 127.0.0.1.
Variables ¶
This section is empty.
Functions ¶
func PreserveTags ¶ added in v1.2.1
func PreserveTags(opts *TestBundleOptions)
Types ¶
type TestBundleOptions ¶ added in v1.2.1
type TestBundleOptions struct {
PreserveTags bool
}
type TestRegistry ¶
type TestRegistry struct {
// contains filtered or unexported fields
}
TestRegistry is a temporary registry that is stopped when the test completes.
func (*TestRegistry) String ¶
func (t *TestRegistry) String() string
String prints the registry URI.
type TestRegistryOptions ¶
type TestRegistryOptions struct { // UseTLS indicates the registry should use http, secured with a self-signed certificate. UseTLS bool // UseAlias indicates that when the TestRegistryAlias environment variable is set, // the registry address use the hostname alias, and not localhost. UseAlias bool }
TestRegistryOptions controls how a test registry is run.
type Tester ¶
type Tester struct { // TestContext is a porter context for the filesystem. TestContext *portercontext.TestContext // TestDir is the temp directory created for the test. TestDir string // PorterHomeDir is the temp PORTER_HOME directory for the test. PorterHomeDir string // RepoRoot is the root of the porter repository. // Useful for constructing paths that won't break when the test is moved. RepoRoot string // T is the test helper. T *testing.T // contains filtered or unexported fields }
func NewTest ¶
NewTest sets up for a smoke test.
Always defer Tester.Close(), even when an error is returned.
func NewTestWithConfig ¶
NewTestWithConfig sets up for a smoke test using the specified Porter config file. The path should be either be absolute, or relative to the repository root.
Always defer Tester.Close(), even when an error is returned.
func (Tester) ApplyTestBundlePrerequisites ¶
func (t Tester) ApplyTestBundlePrerequisites()
ApplyTestBundlePrerequisites ensures that anything required by the test bundle, mybuns, is ready to use.
func (Tester) CurrentNamespace ¶
CurrentNamespace configured in Porter's config file
func (Tester) ListInstallations ¶
func (Tester) MakeTestBundle ¶
func (t Tester) MakeTestBundle(name string, ref string, options ...func(*TestBundleOptions))
func (Tester) PrepareTestBundle ¶
func (t Tester) PrepareTestBundle()
PrepareTestBundle ensures that the mybuns test bundle is ready to use.
func (*Tester) RequireFileMode ¶
RequireFileMode checks that all files in the specified path match the specifed file mode. Uses a glob pattern to match.
func (Tester) RequireInstallationExists ¶
func (t Tester) RequireInstallationExists(namespace string, name string) porter.DisplayInstallation
func (Tester) RequireInstallationInList ¶
func (t Tester) RequireInstallationInList(namespace, name string, list []storage.Installation) storage.Installation
func (Tester) RequireInstallationNotFound ¶
func (Tester) RequireNotFoundReturned ¶
func (Tester) RequirePorter ¶
Run a porter command and fail the test if the command returns an error.
func (Tester) RunPorterWith ¶
func (t Tester) RunPorterWith(opts ...func(*shx.PreparedCommand)) (stdout string, combinedoutput string, err error)
RunPorterWith works like RunPorter, but you can customize the command before it's run.
func (Tester) ShowInstallation ¶
func (Tester) StartTestRegistry ¶
func (t Tester) StartTestRegistry(opts TestRegistryOptions) *TestRegistry
StartTestRegistry runs an OCI registry in a container, returning details about the registry. The registry is cleaned up by default when the test completes.