Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List applying policies in InMemoryChannels status #8011

Merged
merged 13 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add & update integration tests
  • Loading branch information
creydr committed Jun 18, 2024
commit bf55645ff19350261073ada99af84a2cf0c34661
34 changes: 34 additions & 0 deletions pkg/apis/messaging/v1/in_memory_channel_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ func TestInMemoryChannelInitializeConditions(t *testing.T) {
}, {
Type: InMemoryChannelConditionEndpointsReady,
Status: corev1.ConditionUnknown,
}, {
Type: InMemoryChannelConditionEventPoliciesReady,
Status: corev1.ConditionUnknown,
}, {
Type: InMemoryChannelConditionReady,
Status: corev1.ConditionUnknown,
Expand Down Expand Up @@ -177,6 +180,9 @@ func TestInMemoryChannelInitializeConditions(t *testing.T) {
}, {
Type: InMemoryChannelConditionEndpointsReady,
Status: corev1.ConditionUnknown,
}, {
Type: InMemoryChannelConditionEventPoliciesReady,
Status: corev1.ConditionUnknown,
}, {
Type: InMemoryChannelConditionReady,
Status: corev1.ConditionUnknown,
Expand Down Expand Up @@ -217,6 +223,9 @@ func TestInMemoryChannelInitializeConditions(t *testing.T) {
}, {
Type: InMemoryChannelConditionEndpointsReady,
Status: corev1.ConditionUnknown,
}, {
Type: InMemoryChannelConditionEventPoliciesReady,
Status: corev1.ConditionUnknown,
}, {
Type: InMemoryChannelConditionReady,
Status: corev1.ConditionUnknown,
Expand Down Expand Up @@ -244,6 +253,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name string
markServiceReady bool
markChannelServiceReady bool
markEventPolicyReady bool
setAddress bool
markEndpointsReady bool
DLSResolved *bool
Expand All @@ -253,6 +263,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name: "all happy",
markServiceReady: true,
markChannelServiceReady: true,
markEventPolicyReady: true,
markEndpointsReady: true,
dispatcherStatus: deploymentStatusReady,
setAddress: true,
Expand All @@ -262,6 +273,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name: "service not ready",
markServiceReady: false,
markChannelServiceReady: false,
markEventPolicyReady: true,
markEndpointsReady: true,
dispatcherStatus: deploymentStatusReady,
setAddress: true,
Expand All @@ -271,6 +283,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name: "endpoints not ready",
markServiceReady: true,
markChannelServiceReady: false,
markEventPolicyReady: true,
markEndpointsReady: false,
dispatcherStatus: deploymentStatusReady,
setAddress: true,
Expand All @@ -281,6 +294,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
markServiceReady: true,
markEndpointsReady: true,
markChannelServiceReady: false,
markEventPolicyReady: true,
dispatcherStatus: deploymentStatusNotReady,
setAddress: true,
wantReady: false,
Expand All @@ -289,6 +303,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name: "address not set",
markServiceReady: true,
markChannelServiceReady: false,
markEventPolicyReady: true,
markEndpointsReady: true,
dispatcherStatus: deploymentStatusReady,
setAddress: false,
Expand All @@ -298,6 +313,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name: "channel service not ready",
markServiceReady: true,
markChannelServiceReady: false,
markEventPolicyReady: true,
markEndpointsReady: true,
dispatcherStatus: deploymentStatusReady,
setAddress: true,
Expand All @@ -307,6 +323,7 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name: "dls sad",
markServiceReady: true,
markChannelServiceReady: false,
markEventPolicyReady: true,
markEndpointsReady: true,
dispatcherStatus: deploymentStatusReady,
setAddress: true,
Expand All @@ -316,6 +333,17 @@ func TestInMemoryChannelIsReady(t *testing.T) {
name: "dls not configured",
markServiceReady: true,
markChannelServiceReady: false,
markEventPolicyReady: true,
markEndpointsReady: true,
dispatcherStatus: deploymentStatusReady,
setAddress: true,
wantReady: false,
DLSResolved: &trueVal,
}, {
name: "EventPolicy not ready",
markServiceReady: true,
markChannelServiceReady: true,
markEventPolicyReady: false,
markEndpointsReady: true,
dispatcherStatus: deploymentStatusReady,
setAddress: true,
Expand All @@ -336,6 +364,11 @@ func TestInMemoryChannelIsReady(t *testing.T) {
} else {
cs.MarkChannelServiceFailed("NotReadyChannelService", "testing")
}
if test.markEventPolicyReady {
cs.MarkEventPoliciesTrue()
} else {
cs.MarkEndpointsFailed("NotReadyEventPolicy", "testing")
}
if test.setAddress {
cs.SetAddress(&duckv1.Addressable{URL: &apis.URL{Scheme: "http", Host: "foo.bar"}})
}
Expand Down Expand Up @@ -437,6 +470,7 @@ func TestInMemoryChannelStatus_SetAddressable(t *testing.T) {
func ReadyBrokerStatusWithoutDLS() *InMemoryChannelStatus {
imcs := &InMemoryChannelStatus{}
imcs.MarkChannelServiceTrue()
imcs.MarkEventPoliciesTrue()
imcs.MarkDeadLetterSinkNotConfigured()
imcs.MarkEndpointsTrue()
imcs.SetAddress(&duckv1.Addressable{URL: apis.HTTP("example.com")})
Expand Down
12 changes: 8 additions & 4 deletions pkg/reconciler/channel/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ func TestReconcile(t *testing.T) {
WithInMemoryChannelEndpointsReady(),
WithInMemoryChannelChannelServiceReady(),
WithInMemoryChannelAddress(backingChannelAddressable),
WithInMemoryChannelDLSUnknown()),
WithInMemoryChannelDLSUnknown(),
WithInMemoryChannelEventPoliciesReady()),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewChannel(channelName, testNS,
Expand Down Expand Up @@ -165,7 +166,8 @@ func TestReconcile(t *testing.T) {
WithInMemoryChannelChannelServiceReady(),
WithInMemoryChannelSubscribers(subscribers()),
WithInMemoryChannelAddress(backingChannelAddressable),
WithInMemoryChannelDLSUnknown()),
WithInMemoryChannelDLSUnknown(),
WithInMemoryChannelEventPoliciesReady()),
},
}, {
Name: "Backing channel created",
Expand Down Expand Up @@ -259,7 +261,8 @@ func TestReconcile(t *testing.T) {
WithInMemoryChannelChannelServiceReady(),
WithInMemoryChannelSubscribers(subscribers()),
WithInMemoryChannelAddress(backingChannelAddressable),
WithInMemoryChannelDLSUnknown()),
WithInMemoryChannelDLSUnknown(),
WithInMemoryChannelEventPoliciesReady()),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewChannel(channelName, testNS,
Expand Down Expand Up @@ -293,7 +296,8 @@ func TestReconcile(t *testing.T) {
WithInMemoryChannelAddress(backingChannelAddressable),
WithInMemoryChannelSubscribers(subscribers()),
WithInMemoryChannelStatusSubscribers(subscriberStatuses()),
WithInMemoryChannelDLSUnknown()),
WithInMemoryChannelDLSUnknown(),
WithInMemoryChannelEventPoliciesReady()),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewChannel(channelName, testNS,
Expand Down
Loading