Skip to content

Commit

Permalink
Add observedGeneration in JobSink OpenAPI schema
Browse files Browse the repository at this point in the history
Signed-off-by: Pierangelo Di Pilato <[email protected]>
  • Loading branch information
pierDipi committed Nov 4, 2024
1 parent 2e4d353 commit 5a1d40b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
4 changes: 4 additions & 0 deletions config/core/resources/jobsink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ spec:
name:
description: The name of the applied EventPolicy
type: string
observedGeneration:
description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.
type: integer
format: int64
conditions:
description: Conditions the latest available observations of a resource's current state.
type: array
Expand Down
40 changes: 36 additions & 4 deletions pkg/reconciler/jobsink/jobsink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ import (
utilrand "k8s.io/apimachinery/pkg/util/rand"
clientgotesting "k8s.io/client-go/testing"
"k8s.io/utils/ptr"
fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake"
jobsinkreconciler "knative.dev/eventing/pkg/client/injection/reconciler/sinks/v1alpha1/jobsink"
. "knative.dev/eventing/pkg/reconciler/testing/v1"
. "knative.dev/eventing/pkg/reconciler/testing/v1alpha1"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
v1 "knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
Expand All @@ -40,6 +36,12 @@ import (
logtesting "knative.dev/pkg/logging/testing"
"knative.dev/pkg/network"
. "knative.dev/pkg/reconciler/testing"

"knative.dev/eventing/pkg/apis/sinks/v1alpha1"
fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake"
jobsinkreconciler "knative.dev/eventing/pkg/client/injection/reconciler/sinks/v1alpha1/jobsink"
. "knative.dev/eventing/pkg/reconciler/testing/v1"
. "knative.dev/eventing/pkg/reconciler/testing/v1alpha1"
)

const (
Expand Down Expand Up @@ -198,6 +200,36 @@ func TestReconcile(t *testing.T) {
},
},
},
{
Name: "Successful reconciliation, observed generation",
Key: testKey,
Objects: []runtime.Object{
NewJobSink(jobSinkName, testNamespace,
func(sink *v1alpha1.JobSink) {
sink.Generation = 4242
},
WithJobSinkJob(testJob("")),
WithInitJobSinkConditions),
},
WantErr: false,
WantCreates: []runtime.Object{
testJob("test-jobSinkml6mm"),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{
{
Object: NewJobSink(jobSinkName, testNamespace,
WithJobSinkJob(testJob("")),
WithJobSinkAddressableReady(),
WithJobSinkJobStatusSelector(),
WithJobSinkAddress(&jobSinkAddressable),
func(sink *v1alpha1.JobSink) {
sink.Generation = 4242
sink.Status.ObservedGeneration = 4242
},
WithJobSinkEventPoliciesReadyBecauseOIDCDisabled()),
},
},
},
}

logger := logtesting.TestLogger(t)
Expand Down

0 comments on commit 5a1d40b

Please sign in to comment.