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) DescribeNodegroup(ctx context.Context, in *eks.DescribeNodegroupInput, ...) (*eks.DescribeNodegroupOutput, 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) 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) UpdateNodegroupConfig(ctx context.Context, in *eks.UpdateNodegroupConfigInput, ...) (*eks.UpdateNodegroupConfigOutput, 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) 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)
Calls struct {
ListAddons int
DescribeAddon int
DescribeAddonVersions int
UpdateAddon int
DescribeCluster int
ListNodegroups int
DescribeNodegroup int
UpdateNodegroupConfig int
ListClusters int
}
}
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) DescribeNodegroup ¶
func (m *EKSAPI) DescribeNodegroup(ctx context.Context, in *eks.DescribeNodegroupInput, optFns ...func(*eks.Options)) (*eks.DescribeNodegroupOutput, 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) 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) UpdateNodegroupConfig ¶
func (m *EKSAPI) UpdateNodegroupConfig(ctx context.Context, in *eks.UpdateNodegroupConfigInput, optFns ...func(*eks.Options)) (*eks.UpdateNodegroupConfigOutput, 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) WithUpdateAddon ¶
func (b *EKSAPIBuilder) WithUpdateAddon(updateID string) *EKSAPIBuilder
WithUpdateAddon sets UpdateAddon to return a successful in-progress update.