Documentation
¶
Index ¶
- func BuildChart(opts ...ChartOption) *helmchart.Chart
- func BuildChartWithSubchartWithCRD() *helmchart.Chart
- func BuildRelease(mockOpts *helmrelease.MockReleaseOptions, opts ...ReleaseOption) *helmrelease.Release
- func Equal(expected any, options ...cmp.Option) types.GomegaMatcher
- func MustParseHelmTime(t string) time.Time
- func NewMockResourceManagerFunc() func(sr ...newStatusReaderFunc) *ssa.ResourceManager
- func SaveChart(c *chart.Chart, outDir string) (string, error)
- func SaveChartAsArtifact(c *chart.Chart, algo digest.Algorithm, baseURL, outDir string) (*meta.Artifact, error)
- type ChartOption
- func ChartWithCRD() ChartOption
- func ChartWithDependency(md *helmchart.Dependency, chrt *helmchart.Chart) ChartOption
- func ChartWithFailingDeployment() ChartOption
- func ChartWithFailingHook() ChartOption
- func ChartWithFailingTestHook() ChartOption
- func ChartWithManifestWithCustomName(name string) ChartOption
- func ChartWithName(name string) ChartOption
- func ChartWithTestHook() ChartOption
- func ChartWithValues(values map[string]any) ChartOption
- func ChartWithVersion(version string) ChartOption
- type ChartOptions
- type MockSLogHandler
- type MockStatusReader
- func (m *MockStatusReader) NewResourceManagerFunc() func(sr ...newStatusReaderFunc) *ssa.ResourceManager
- func (m *MockStatusReader) NewResourceManagerFuncWithClient(c client.Client, mapper apimeta.RESTMapper) func(sr ...newStatusReaderFunc) *ssa.ResourceManager
- func (m *MockStatusReader) ReadStatus(ctx context.Context, reader engine.ClusterReader, resource object.ObjMetadata) (*event.ResourceStatus, error)
- func (m *MockStatusReader) ReadStatusForObject(ctx context.Context, reader engine.ClusterReader, ...) (*event.ResourceStatus, error)
- func (m *MockStatusReader) ReadStatusForObjectCalled() int
- func (m *MockStatusReader) Supports(gk schema.GroupKind) bool
- func (m *MockStatusReader) SupportsCalled() int
- type ReleaseOption
- func ReleaseWithConfig(config map[string]any) ReleaseOption
- func ReleaseWithFailingHook() ReleaseOption
- func ReleaseWithFailingTestHook() ReleaseOption
- func ReleaseWithHookExecution(name string, events []helmrelease.HookEvent, phase helmrelease.HookPhase) ReleaseOption
- func ReleaseWithHooks(hooks []*helmrelease.Hook) ReleaseOption
- func ReleaseWithLabels(labels map[string]string) ReleaseOption
- func ReleaseWithTestHook() ReleaseOption
- type ReleaseOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildChart ¶
func BuildChart(opts ...ChartOption) *helmchart.Chart
BuildChart returns a Helm chart object built with basic data and any provided chart options.
func BuildChartWithSubchartWithCRD ¶ added in v1.2.0
BuildChartWithSubchartWithCRD returns a Helm chart object with a subchart that contains a CRD. Useful for testing helm-controller's staged CRDs-first deployment logic.
func BuildRelease ¶
func BuildRelease(mockOpts *helmrelease.MockReleaseOptions, opts ...ReleaseOption) *helmrelease.Release
BuildRelease builds a release with release.Mock using the given options, and applies any provided options to the release before returning it.
func Equal ¶
func Equal(expected any, options ...cmp.Option) types.GomegaMatcher
Equal uses go-cmp to compare actual with expected. Equal is strict about types when performing comparisons.
func MustParseHelmTime ¶
MustParseHelmTime parses a string into a Helm time.Time, panicking if it fails.
func NewMockResourceManagerFunc ¶ added in v1.5.0
func NewMockResourceManagerFunc() func(sr ...newStatusReaderFunc) *ssa.ResourceManager
NewMockResourceManagerFunc returns a function compatible with action.WithResourceManager using a new MockStatusReader.
func SaveChart ¶
SaveChart saves the given chart to the given directory, and returns the path to the saved chart. The chart is saved with a random suffix to avoid name collisions.
func SaveChartAsArtifact ¶
func SaveChartAsArtifact(c *chart.Chart, algo digest.Algorithm, baseURL, outDir string) (*meta.Artifact, error)
SaveChartAsArtifact saves the given chart to the given directory, and returns an artifact with the chart's metadata. The chart is saved with a random suffix to avoid name collisions.
Types ¶
type ChartOption ¶
type ChartOption func(*ChartOptions)
ChartOption is a function that can be used to modify a chart.
func ChartWithCRD ¶ added in v1.2.0
func ChartWithCRD() ChartOption
ChartWithCRD appends a CRD to the chart.
func ChartWithDependency ¶ added in v1.2.0
func ChartWithDependency(md *helmchart.Dependency, chrt *helmchart.Chart) ChartOption
ChartWithDependency appends a dependency to the chart.
func ChartWithFailingDeployment ¶ added in v1.5.0
func ChartWithFailingDeployment() ChartOption
ChartWithFailingDeployment appends a deployment with a non-existent image to the chart. This is useful for testing health check timeout and cancellation scenarios.
func ChartWithFailingHook ¶
func ChartWithFailingHook() ChartOption
ChartWithFailingHook appends a failing hook to the chart.
func ChartWithFailingTestHook ¶
func ChartWithFailingTestHook() ChartOption
ChartWithFailingTestHook appends a failing test hook to the chart.
func ChartWithManifestWithCustomName ¶ added in v1.2.0
func ChartWithManifestWithCustomName(name string) ChartOption
ChartWithManifestWithCustomName sets the name of the manifest.
func ChartWithName ¶
func ChartWithName(name string) ChartOption
ChartWithName sets the name of the chart.
func ChartWithTestHook ¶
func ChartWithTestHook() ChartOption
ChartWithTestHook appends a test hook to the chart.
func ChartWithValues ¶ added in v1.2.0
func ChartWithValues(values map[string]any) ChartOption
ChartWithValues sets the values.yaml file of the chart.
func ChartWithVersion ¶
func ChartWithVersion(version string) ChartOption
ChartWithVersion sets the version of the chart.
type ChartOptions ¶
ChartOptions is a helper to build a Helm chart object.
type MockSLogHandler ¶ added in v1.5.0
type MockSLogHandler struct {
Called bool
}
MockSLogHandler lets callers know if Handle was called.
type MockStatusReader ¶ added in v1.5.0
type MockStatusReader struct {
// contains filtered or unexported fields
}
MockStatusReader is a mock implementation of engine.StatusReader that returns a healthy status for all resources and tracks method calls.
func (*MockStatusReader) NewResourceManagerFunc ¶ added in v1.5.0
func (m *MockStatusReader) NewResourceManagerFunc() func(sr ...newStatusReaderFunc) *ssa.ResourceManager
NewResourceManagerFunc returns a function compatible with action.WithResourceManager that uses this MockStatusReader as a custom status reader in the returned ResourceManager.
func (*MockStatusReader) NewResourceManagerFuncWithClient ¶ added in v1.5.0
func (m *MockStatusReader) NewResourceManagerFuncWithClient(c client.Client, mapper apimeta.RESTMapper) func(sr ...newStatusReaderFunc) *ssa.ResourceManager
NewResourceManagerFuncWithClient returns a function compatible with action.WithResourceManager that uses this MockStatusReader with a real client and REST mapper for the poller engine.
func (*MockStatusReader) ReadStatus ¶ added in v1.5.0
func (m *MockStatusReader) ReadStatus(ctx context.Context, reader engine.ClusterReader, resource object.ObjMetadata) (*event.ResourceStatus, error)
ReadStatus returns a Current status for any resource.
func (*MockStatusReader) ReadStatusForObject ¶ added in v1.5.0
func (m *MockStatusReader) ReadStatusForObject(ctx context.Context, reader engine.ClusterReader, obj *unstructured.Unstructured) (*event.ResourceStatus, error)
ReadStatusForObject returns a Current status for any object and records the call.
func (*MockStatusReader) ReadStatusForObjectCalled ¶ added in v1.5.0
func (m *MockStatusReader) ReadStatusForObjectCalled() int
ReadStatusForObjectCalled returns the number of times ReadStatusForObject was called.
func (*MockStatusReader) Supports ¶ added in v1.5.0
func (m *MockStatusReader) Supports(gk schema.GroupKind) bool
Supports returns true for all GroupKinds and records the call.
func (*MockStatusReader) SupportsCalled ¶ added in v1.5.0
func (m *MockStatusReader) SupportsCalled() int
SupportsCalled returns the number of times Supports was called.
type ReleaseOption ¶
type ReleaseOption func(*ReleaseOptions)
ReleaseOption is a function that can be used to modify a release.
func ReleaseWithConfig ¶
func ReleaseWithConfig(config map[string]any) ReleaseOption
ReleaseWithConfig sets the config on the release.
func ReleaseWithFailingHook ¶
func ReleaseWithFailingHook() ReleaseOption
ReleaseWithFailingHook appends a failing hook to the release.
func ReleaseWithFailingTestHook ¶
func ReleaseWithFailingTestHook() ReleaseOption
ReleaseWithFailingTestHook appends a failing test hook to the release.
func ReleaseWithHookExecution ¶
func ReleaseWithHookExecution(name string, events []helmrelease.HookEvent, phase helmrelease.HookPhase) ReleaseOption
ReleaseWithHookExecution appends a hook with a last run with the given execution phase on the release.
func ReleaseWithHooks ¶
func ReleaseWithHooks(hooks []*helmrelease.Hook) ReleaseOption
ReleaseWithHooks sets the hooks on the release.
func ReleaseWithLabels ¶
func ReleaseWithLabels(labels map[string]string) ReleaseOption
ReleaseWithLabels sets the labels on the release.
func ReleaseWithTestHook ¶
func ReleaseWithTestHook() ReleaseOption
ReleaseWithTestHook appends a test hook to the release.
type ReleaseOptions ¶
type ReleaseOptions struct {
*helmrelease.Release
}
ReleaseOptions is a helper to build a Helm release mock.