Documentation
¶
Index ¶
- Variables
- func AssertBackfillRequestCompleted(t *testing.T, k8sClient client.Client, objectName types.NamespacedName)
- func AssertBackfillRequestNotCompleted(t *testing.T, k8sClient client.Client, objectName types.NamespacedName)
- func AssertCronJobExists(t *testing.T, k8sClient client.Client, name types.NamespacedName, ...)
- func AssertCronJobNotExists(t *testing.T, k8sClient client.Client, name types.NamespacedName)
- func AssertEventRecorded(t *testing.T, recorder *record.FakeRecorder, _ types.NamespacedName, ...)
- func AssertJobConfiguration(t *testing.T, k8sClient client.Client, name types.NamespacedName, ...)
- func AssertJobExists(t *testing.T, k8sClient client.Client, name types.NamespacedName)
- func AssertJobNotExists(t *testing.T, k8sClient client.Client, name types.NamespacedName)
- func AssertStreamDefinitionPhase(t *testing.T, k8sClient client.Client, name types.NamespacedName, ...)
- func GetStreamDefinitionUnstructured(ctx context.Context, k8sClient client.Client, name types.NamespacedName, ...) (*unstructured.Unstructured, error)
- func SetupClientFromBuilders(builderV1 *mockv1.MockStreamDefinitionBuilder, ...) client.Client
- type FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) Apply(fn func(*crfake.ClientBuilder)) *FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) Build() func(*crfake.ClientBuilder)
- func (b *FakeClientResourcesBuilder) WithBackfillRequest(n types.NamespacedName) *FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) WithCompletedJob(n types.NamespacedName) *FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) WithConsistentCronJob(n types.NamespacedName, hash string) *FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) WithConsistentJob(n types.NamespacedName, hash string) *FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) WithFailedJob(n types.NamespacedName) *FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) WithOutdatedCronJob(n types.NamespacedName) *FakeClientResourcesBuilder
- func (b *FakeClientResourcesBuilder) WithOutdatedJob(n types.NamespacedName) *FakeClientResourcesBuilder
Constants ¶
This section is empty.
Variables ¶
var GroupVersionKindV1 = schema.GroupVersionKind{
Group: "streaming.sneaksanddata.com",
Version: "v1",
Kind: "MockStreamDefinition",
}
var GroupVersionKindV2 = schema.GroupVersionKind{
Group: "streaming.sneaksanddata.com",
Version: "v2",
Kind: "MockStreamDefinition",
}
Functions ¶
func AssertCronJobExists ¶
func AssertCronJobNotExists ¶
func AssertEventRecorded ¶ added in v1.1.4
func AssertEventRecorded(t *testing.T, recorder *record.FakeRecorder, _ types.NamespacedName, additionalAssert func(*testing.T, string))
AssertEventRecorded drains all events currently buffered in the FakeRecorder and runs the provided assertion against each one. Each event has the format "<type> <reason> <message>" as produced by record.FakeRecorder. If additionalAssert is nil, only asserts that at least one event was recorded.
func AssertJobConfiguration ¶
func AssertJobExists ¶
func AssertJobNotExists ¶
func GetStreamDefinitionUnstructured ¶
func GetStreamDefinitionUnstructured(ctx context.Context, k8sClient client.Client, name types.NamespacedName, gvk schema.GroupVersionKind) (*unstructured.Unstructured, error)
GetStreamDefinitionUnstructured reads the MockStreamDefinition identified by name from the provided client and returns it as an *unstructured.Unstructured.
func SetupClientFromBuilders ¶
func SetupClientFromBuilders(builderV1 *mockv1.MockStreamDefinitionBuilder, builderV2 *v2.MockStreamDefinitionBuilder, resources *FakeClientResourcesBuilder) client.Client
SetupClientFromBuilders constructs a fake controller-runtime client seeded with the *testv1.MockStreamDefinition and/or *testv2.MockStreamDefinition produced by the provided builders.
Types ¶
type FakeClientResourcesBuilder ¶
type FakeClientResourcesBuilder struct {
// contains filtered or unexported fields
}
FakeClientResourcesBuilder provides a fluent builder for accumulating secondary Kubernetes resources (Jobs, CronJobs, BackfillRequests, ...) that should be seeded into a controller-runtime fake client. The builder produces a single mutator function suitable for the addResources parameter of SetupClient / SetupClientFromBuilders.
func NewFakeClientResourcesBuilder ¶
func NewFakeClientResourcesBuilder() *FakeClientResourcesBuilder
NewFakeClientResourcesBuilder creates an empty FakeClientResourcesBuilder.
func (*FakeClientResourcesBuilder) Apply ¶
func (b *FakeClientResourcesBuilder) Apply(fn func(*crfake.ClientBuilder)) *FakeClientResourcesBuilder
Apply appends an arbitrary mutator function to the builder. This allows composing the builder with existing functional-option style helpers.
func (*FakeClientResourcesBuilder) Build ¶
func (b *FakeClientResourcesBuilder) Build() func(*crfake.ClientBuilder)
Build returns a single mutator function that applies all accumulated resources to a *crfake.ClientBuilder. The result is computed on the first call and the same function value is returned on subsequent calls.
func (*FakeClientResourcesBuilder) WithBackfillRequest ¶
func (b *FakeClientResourcesBuilder) WithBackfillRequest(n types.NamespacedName) *FakeClientResourcesBuilder
WithBackfillRequest seeds the fake client with a BackfillRequest named "backfill1" targeting the MockStreamDefinition identified by n.
func (*FakeClientResourcesBuilder) WithCompletedJob ¶
func (b *FakeClientResourcesBuilder) WithCompletedJob(n types.NamespacedName) *FakeClientResourcesBuilder
WithCompletedJob seeds the fake client with a batch Job in a completed state.
func (*FakeClientResourcesBuilder) WithConsistentCronJob ¶
func (b *FakeClientResourcesBuilder) WithConsistentCronJob(n types.NamespacedName, hash string) *FakeClientResourcesBuilder
WithConsistentCronJob seeds the fake client with a CronJob whose configuration-hash annotation matches the provided hash.
func (*FakeClientResourcesBuilder) WithConsistentJob ¶
func (b *FakeClientResourcesBuilder) WithConsistentJob(n types.NamespacedName, hash string) *FakeClientResourcesBuilder
WithConsistentJob seeds the fake client with a batch Job whose configuration-hash annotation matches the provided hash.
func (*FakeClientResourcesBuilder) WithFailedJob ¶
func (b *FakeClientResourcesBuilder) WithFailedJob(n types.NamespacedName) *FakeClientResourcesBuilder
WithFailedJob seeds the fake client with a batch Job in a failed state (failed twice with backoffLimit = 1).
func (*FakeClientResourcesBuilder) WithOutdatedCronJob ¶
func (b *FakeClientResourcesBuilder) WithOutdatedCronJob(n types.NamespacedName) *FakeClientResourcesBuilder
WithOutdatedCronJob seeds the fake client with a CronJob whose configuration-hash annotation is set to "old-hash".
func (*FakeClientResourcesBuilder) WithOutdatedJob ¶
func (b *FakeClientResourcesBuilder) WithOutdatedJob(n types.NamespacedName) *FakeClientResourcesBuilder
WithOutdatedJob seeds the fake client with a batch Job whose configuration-hash annotation is set to "old-hash".