Documentation
¶
Overview ¶
Package mocks provides configurable mock implementations of AWS client interfaces used across the service packages. Each mock uses function fields so individual test cases can inject their own behavior without subclassing.
A single EKSAPI struct satisfies addons.EKSAPI, nodegroup.EKSAPI, and cluster.EKSAPI — the union of all their methods.
Index ¶
- type EKSAPI
- func (m *EKSAPI) DescribeAddon(ctx context.Context, in *eks.DescribeAddonInput, optFns ...func(*eks.Options)) (*eks.DescribeAddonOutput, error)
- func (m *EKSAPI) DescribeAddonVersions(ctx context.Context, in *eks.DescribeAddonVersionsInput, ...) (*eks.DescribeAddonVersionsOutput, error)
- func (m *EKSAPI) DescribeCluster(ctx context.Context, in *eks.DescribeClusterInput, ...) (*eks.DescribeClusterOutput, error)
- func (m *EKSAPI) DescribeClusterVersions(ctx context.Context, in *eks.DescribeClusterVersionsInput, ...) (*eks.DescribeClusterVersionsOutput, error)
- func (m *EKSAPI) DescribeInsight(ctx context.Context, in *eks.DescribeInsightInput, ...) (*eks.DescribeInsightOutput, error)
- func (m *EKSAPI) DescribeNodegroup(ctx context.Context, in *eks.DescribeNodegroupInput, ...) (*eks.DescribeNodegroupOutput, error)
- func (m *EKSAPI) DescribeUpdate(ctx context.Context, in *eks.DescribeUpdateInput, optFns ...func(*eks.Options)) (*eks.DescribeUpdateOutput, error)
- func (m *EKSAPI) ListAddons(ctx context.Context, in *eks.ListAddonsInput, optFns ...func(*eks.Options)) (*eks.ListAddonsOutput, error)
- func (m *EKSAPI) ListClusters(ctx context.Context, in *eks.ListClustersInput, optFns ...func(*eks.Options)) (*eks.ListClustersOutput, error)
- func (m *EKSAPI) ListInsights(ctx context.Context, in *eks.ListInsightsInput, optFns ...func(*eks.Options)) (*eks.ListInsightsOutput, error)
- func (m *EKSAPI) ListNodegroups(ctx context.Context, in *eks.ListNodegroupsInput, optFns ...func(*eks.Options)) (*eks.ListNodegroupsOutput, error)
- func (m *EKSAPI) UpdateAddon(ctx context.Context, in *eks.UpdateAddonInput, optFns ...func(*eks.Options)) (*eks.UpdateAddonOutput, error)
- func (m *EKSAPI) UpdateClusterVersion(ctx context.Context, in *eks.UpdateClusterVersionInput, ...) (*eks.UpdateClusterVersionOutput, error)
- func (m *EKSAPI) UpdateNodegroupConfig(ctx context.Context, in *eks.UpdateNodegroupConfigInput, ...) (*eks.UpdateNodegroupConfigOutput, error)
- func (m *EKSAPI) UpdateNodegroupVersion(ctx context.Context, in *eks.UpdateNodegroupVersionInput, ...) (*eks.UpdateNodegroupVersionOutput, error)
- type EKSAPIBuilder
- func (b *EKSAPIBuilder) Build() *EKSAPI
- func (b *EKSAPIBuilder) WithAddon(name, version string, status ekstypes.AddonStatus) *EKSAPIBuilder
- func (b *EKSAPIBuilder) WithAddonVersions(addonName string, versions []string, k8sVersion string) *EKSAPIBuilder
- func (b *EKSAPIBuilder) WithCluster(name, k8sVersion string) *EKSAPIBuilder
- func (b *EKSAPIBuilder) WithDescribeUpdate(status ekstypes.UpdateStatus) *EKSAPIBuilder
- func (b *EKSAPIBuilder) WithInsight(name string, status ekstypes.InsightStatusValue, k8sVersion string) *EKSAPIBuilder
- func (b *EKSAPIBuilder) WithNodegroup(name, k8sVersion string, amiType ekstypes.AMITypes) *EKSAPIBuilder
- func (b *EKSAPIBuilder) WithUpdateAddon(updateID string) *EKSAPIBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EKSAPI ¶
type EKSAPI struct {
ListAddonsFn func(ctx context.Context, in *eks.ListAddonsInput, optFns ...func(*eks.Options)) (*eks.ListAddonsOutput, error)
DescribeAddonFn func(ctx context.Context, in *eks.DescribeAddonInput, optFns ...func(*eks.Options)) (*eks.DescribeAddonOutput, error)
DescribeAddonVersionsFn func(ctx context.Context, in *eks.DescribeAddonVersionsInput, optFns ...func(*eks.Options)) (*eks.DescribeAddonVersionsOutput, error)
UpdateAddonFn func(ctx context.Context, in *eks.UpdateAddonInput, optFns ...func(*eks.Options)) (*eks.UpdateAddonOutput, error)
DescribeClusterFn func(ctx context.Context, in *eks.DescribeClusterInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterOutput, error)
ListNodegroupsFn func(ctx context.Context, in *eks.ListNodegroupsInput, optFns ...func(*eks.Options)) (*eks.ListNodegroupsOutput, error)
DescribeNodegroupFn func(ctx context.Context, in *eks.DescribeNodegroupInput, optFns ...func(*eks.Options)) (*eks.DescribeNodegroupOutput, error)
UpdateNodegroupConfigFn func(ctx context.Context, in *eks.UpdateNodegroupConfigInput, optFns ...func(*eks.Options)) (*eks.UpdateNodegroupConfigOutput, error)
ListClustersFn func(ctx context.Context, in *eks.ListClustersInput, optFns ...func(*eks.Options)) (*eks.ListClustersOutput, error)
UpdateClusterVersionFn func(ctx context.Context, in *eks.UpdateClusterVersionInput, optFns ...func(*eks.Options)) (*eks.UpdateClusterVersionOutput, error)
UpdateNodegroupVersionFn func(ctx context.Context, in *eks.UpdateNodegroupVersionInput, optFns ...func(*eks.Options)) (*eks.UpdateNodegroupVersionOutput, error)
DescribeUpdateFn func(ctx context.Context, in *eks.DescribeUpdateInput, optFns ...func(*eks.Options)) (*eks.DescribeUpdateOutput, error)
DescribeClusterVersionsFn func(ctx context.Context, in *eks.DescribeClusterVersionsInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterVersionsOutput, error)
ListInsightsFn func(ctx context.Context, in *eks.ListInsightsInput, optFns ...func(*eks.Options)) (*eks.ListInsightsOutput, error)
DescribeInsightFn func(ctx context.Context, in *eks.DescribeInsightInput, optFns ...func(*eks.Options)) (*eks.DescribeInsightOutput, error)
Calls struct {
ListAddons int
DescribeAddon int
DescribeAddonVersions int
UpdateAddon int
DescribeCluster int
ListNodegroups int
DescribeNodegroup int
UpdateNodegroupConfig int
ListClusters int
UpdateClusterVersion int
UpdateNodegroupVersion int
DescribeUpdate int
DescribeClusterVersions int
ListInsights int
DescribeInsight int
}
// contains filtered or unexported fields
}
EKSAPI is a test double for the EKS client. Set any Fn field to control the response for that method; leave it nil to get a "not implemented" panic that identifies the unexpected call in test output.
Calls tracks how many times each method was invoked.
func (*EKSAPI) DescribeAddon ¶
func (m *EKSAPI) DescribeAddon(ctx context.Context, in *eks.DescribeAddonInput, optFns ...func(*eks.Options)) (*eks.DescribeAddonOutput, error)
func (*EKSAPI) DescribeAddonVersions ¶
func (m *EKSAPI) DescribeAddonVersions(ctx context.Context, in *eks.DescribeAddonVersionsInput, optFns ...func(*eks.Options)) (*eks.DescribeAddonVersionsOutput, error)
func (*EKSAPI) DescribeCluster ¶
func (m *EKSAPI) DescribeCluster(ctx context.Context, in *eks.DescribeClusterInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterOutput, error)
func (*EKSAPI) DescribeClusterVersions ¶ added in v0.7.0
func (m *EKSAPI) DescribeClusterVersions(ctx context.Context, in *eks.DescribeClusterVersionsInput, optFns ...func(*eks.Options)) (*eks.DescribeClusterVersionsOutput, error)
func (*EKSAPI) DescribeInsight ¶ added in v0.7.0
func (m *EKSAPI) DescribeInsight(ctx context.Context, in *eks.DescribeInsightInput, optFns ...func(*eks.Options)) (*eks.DescribeInsightOutput, error)
func (*EKSAPI) DescribeNodegroup ¶
func (m *EKSAPI) DescribeNodegroup(ctx context.Context, in *eks.DescribeNodegroupInput, optFns ...func(*eks.Options)) (*eks.DescribeNodegroupOutput, error)
func (*EKSAPI) DescribeUpdate ¶ added in v0.7.0
func (m *EKSAPI) DescribeUpdate(ctx context.Context, in *eks.DescribeUpdateInput, optFns ...func(*eks.Options)) (*eks.DescribeUpdateOutput, error)
func (*EKSAPI) ListAddons ¶
func (m *EKSAPI) ListAddons(ctx context.Context, in *eks.ListAddonsInput, optFns ...func(*eks.Options)) (*eks.ListAddonsOutput, error)
func (*EKSAPI) ListClusters ¶
func (m *EKSAPI) ListClusters(ctx context.Context, in *eks.ListClustersInput, optFns ...func(*eks.Options)) (*eks.ListClustersOutput, error)
func (*EKSAPI) ListInsights ¶ added in v0.7.0
func (m *EKSAPI) ListInsights(ctx context.Context, in *eks.ListInsightsInput, optFns ...func(*eks.Options)) (*eks.ListInsightsOutput, error)
func (*EKSAPI) ListNodegroups ¶
func (m *EKSAPI) ListNodegroups(ctx context.Context, in *eks.ListNodegroupsInput, optFns ...func(*eks.Options)) (*eks.ListNodegroupsOutput, error)
func (*EKSAPI) UpdateAddon ¶
func (m *EKSAPI) UpdateAddon(ctx context.Context, in *eks.UpdateAddonInput, optFns ...func(*eks.Options)) (*eks.UpdateAddonOutput, error)
func (*EKSAPI) UpdateClusterVersion ¶ added in v0.7.0
func (m *EKSAPI) UpdateClusterVersion(ctx context.Context, in *eks.UpdateClusterVersionInput, optFns ...func(*eks.Options)) (*eks.UpdateClusterVersionOutput, error)
func (*EKSAPI) UpdateNodegroupConfig ¶
func (m *EKSAPI) UpdateNodegroupConfig(ctx context.Context, in *eks.UpdateNodegroupConfigInput, optFns ...func(*eks.Options)) (*eks.UpdateNodegroupConfigOutput, error)
func (*EKSAPI) UpdateNodegroupVersion ¶ added in v0.7.0
func (m *EKSAPI) UpdateNodegroupVersion(ctx context.Context, in *eks.UpdateNodegroupVersionInput, optFns ...func(*eks.Options)) (*eks.UpdateNodegroupVersionOutput, error)
type EKSAPIBuilder ¶
type EKSAPIBuilder struct {
// contains filtered or unexported fields
}
EKSAPIBuilder constructs a mocks.EKSAPI with sensible defaults. Call methods to override individual behaviours before calling Build.
func NewEKSAPI ¶
func NewEKSAPI() *EKSAPIBuilder
NewEKSAPI returns a builder whose mock returns empty-but-valid responses by default. Override individual Fn fields or call builder methods for the behaviour each test needs.
func (*EKSAPIBuilder) Build ¶
func (b *EKSAPIBuilder) Build() *EKSAPI
Build returns the fully configured mock.
func (*EKSAPIBuilder) WithAddon ¶
func (b *EKSAPIBuilder) WithAddon(name, version string, status ekstypes.AddonStatus) *EKSAPIBuilder
WithAddon registers an addon so that ListAddons includes it and DescribeAddon returns its details. Calling WithAddon multiple times accumulates addons.
func (*EKSAPIBuilder) WithAddonVersions ¶
func (b *EKSAPIBuilder) WithAddonVersions(addonName string, versions []string, k8sVersion string) *EKSAPIBuilder
WithAddonVersions sets DescribeAddonVersions to return the given version list when queried for addonName. Versions should be in descending order (latest first).
func (*EKSAPIBuilder) WithCluster ¶
func (b *EKSAPIBuilder) WithCluster(name, k8sVersion string) *EKSAPIBuilder
WithCluster sets DescribeCluster to return the given name and Kubernetes version.
func (*EKSAPIBuilder) WithDescribeUpdate ¶ added in v0.7.0
func (b *EKSAPIBuilder) WithDescribeUpdate(status ekstypes.UpdateStatus) *EKSAPIBuilder
WithDescribeUpdate sets DescribeUpdate to report every update with the given terminal status.
func (*EKSAPIBuilder) WithInsight ¶ added in v0.7.0
func (b *EKSAPIBuilder) WithInsight(name string, status ekstypes.InsightStatusValue, k8sVersion string) *EKSAPIBuilder
WithInsight registers an UPGRADE_READINESS insight returned for the given Kubernetes version. Calling WithInsight multiple times accumulates.
func (*EKSAPIBuilder) WithNodegroup ¶ added in v0.7.0
func (b *EKSAPIBuilder) WithNodegroup(name, k8sVersion string, amiType ekstypes.AMITypes) *EKSAPIBuilder
WithNodegroup registers a nodegroup so ListNodegroups includes it and DescribeNodegroup returns its details (ACTIVE, no health issues). Calling WithNodegroup multiple times accumulates nodegroups in order.
func (*EKSAPIBuilder) WithUpdateAddon ¶
func (b *EKSAPIBuilder) WithUpdateAddon(updateID string) *EKSAPIBuilder
WithUpdateAddon sets UpdateAddon to return a successful in-progress update.