Skip to content

Commit

Permalink
Address comments, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aliok committed Apr 27, 2021
1 parent faaaedd commit b94401f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/flows/v1/sequence_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestSequenceGetConditionSet(t *testing.T) {
func getSubscription(name string, ready bool) *messagingv1.Subscription {
s := messagingv1.Subscription{
TypeMeta: metav1.TypeMeta{
APIVersion: "eventing.knative.dev/v1",
APIVersion: "messaging.knative.dev/v1",
Kind: "Subscription",
},
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -217,7 +217,7 @@ func TestSequencePropagateSubscriptionStatuses(t *testing.T) {
name: "empty status",
subs: []*messagingv1.Subscription{{
TypeMeta: metav1.TypeMeta{
APIVersion: "eventing.knative.dev/v1",
APIVersion: "messaging.knative.dev/v1",
Kind: "Subscription",
},
ObjectMeta: metav1.ObjectMeta{
Expand Down
3 changes: 2 additions & 1 deletion pkg/duck/listable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ import (
"k8s.io/client-go/tools/cache"
"knative.dev/pkg/apis/duck"
duckv1 "knative.dev/pkg/apis/duck/v1"
duckv1alpha1 "knative.dev/pkg/apis/duck/v1alpha1"
"knative.dev/pkg/client/injection/ducks/duck/v1alpha1/addressable"
fakedynamicclient "knative.dev/pkg/injection/clients/dynamicclient/fake"
)

func init() {
// Add types to scheme
_ = duckv1.AddToScheme(scheme.Scheme)
_ = duckv1alpha1.AddToScheme(scheme.Scheme)
}

const ns = "test-ns"
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/broker/testdata/config-broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ data:
channelTemplateSpec: |
# The api and version of the kind of channel to use inthe broker.
# This field required.
apiVersion: messaging.knative.dev/v1alpha1
apiVersion: messaging.knative.dev/v1
# The api and version of the kind of channel to use inthe broker.
# This field required.
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/parallel/parallel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const (

var (
subscriberGVK = metav1.GroupVersionKind{
Group: "eventing.knative.dev",
Group: "messaging.knative.dev",
Version: "v1",
Kind: "Subscriber",
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/sequence/sequence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const (

var (
subscriberGVK = metav1.GroupVersionKind{
Group: "eventing.knative.dev",
Group: "messaging.knative.dev",
Version: "v1",
Kind: "Subscriber",
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/source/crd/crd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const (
crdGroup = "testing.sources.knative.dev"
crdKind = "TestSource"
crdPlural = "testsources"
crdVersionServed = "v1"
crdVersionServed = "v1alpha1"
)

var crdGVR = schema.GroupVersionResource{
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/source/duck/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ func TestNew(t *testing.T) {

gvr := schema.GroupVersionResource{
Group: "testing.sources.knative.dev",
Version: "v1",
Version: "v1alpha1",
Resource: "testsources",
}
gvk := schema.GroupVersionKind{
Group: "testing.sources.knative.dev",
Version: "v1",
Version: "v1alpha1",
Kind: "TestSource",
}
crd := "testsources.testing.sources.knative.dev"
Expand Down
4 changes: 2 additions & 2 deletions pkg/reconciler/source/duck/duck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ var (

gvr = schema.GroupVersionResource{
Group: "testing.sources.knative.dev",
Version: "v1",
Version: "v1alpha1",
Resource: "testsources",
}

gvk = schema.GroupVersionKind{
Group: "testing.sources.knative.dev",
Version: "v1",
Version: "v1alpha1",
Kind: "TestSource",
}
)
Expand Down
18 changes: 9 additions & 9 deletions pkg/reconciler/subscription/subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var (
dlc2DNS = "dlc2.mynamespace.svc." + network.GetClusterDomainName()

subscriberGVK = metav1.GroupVersionKind{
Group: "eventing.knative.dev",
Group: "messaging.knative.dev",
Version: "v1",
Kind: "Subscriber",
}
Expand Down Expand Up @@ -293,7 +293,7 @@ func TestAllCases(t *testing.T) {
Key: testNS + "/" + subscriptionName,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:messaging.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -302,7 +302,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionSubscriberRef(subscriberGVK, subscriberName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, "Failed to resolve spec.subscriber: address not set for &ObjectReference{Kind:Subscriber,Namespace:testnamespace,Name:subscriber,UID:,APIVersion:messaging.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
),
}},
WantPatches: []clientgotesting.PatchActionImpl{
Expand All @@ -324,7 +324,7 @@ func TestAllCases(t *testing.T) {
Key: testNS + "/" + subscriptionName,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: subscribers.eventing.knative.dev %q not found", subscriberName),
Eventf(corev1.EventTypeWarning, "SubscriberResolveFailed", "Failed to resolve spec.subscriber: subscribers.messaging.knative.dev %q not found", subscriberName),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -333,7 +333,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionSubscriberRef(subscriberGVK, subscriberName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, `Failed to resolve spec.subscriber: subscribers.eventing.knative.dev "subscriber" not found`),
WithSubscriptionReferencesNotResolved(subscriberResolveFailed, `Failed to resolve spec.subscriber: subscribers.messaging.knative.dev "subscriber" not found`),
),
}},
WantPatches: []clientgotesting.PatchActionImpl{
Expand Down Expand Up @@ -396,7 +396,7 @@ func TestAllCases(t *testing.T) {
Key: testNS + "/" + subscriptionName,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
Eventf(corev1.EventTypeWarning, replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -407,7 +407,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionReply(nonAddressableGVK, replyName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved(replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1alpha1,ResourceVersion:,FieldPath:,}"),
WithSubscriptionReferencesNotResolved(replyResolveFailed, "Failed to resolve spec.reply: address not set for &ObjectReference{Kind:Trigger,Namespace:testnamespace,Name:reply,UID:,APIVersion:eventing.knative.dev/v1,ResourceVersion:,FieldPath:,}"),
),
}},
WantPatches: []clientgotesting.PatchActionImpl{
Expand Down Expand Up @@ -477,7 +477,7 @@ func TestAllCases(t *testing.T) {
WantErr: false,
WantEvents: []string{
Eventf(corev1.EventTypeNormal, "FinalizerUpdate", "Updated %q finalizers", subscriptionName),
Eventf(corev1.EventTypeWarning, "DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.eventing.knative.dev "dlc" not found`),
Eventf(corev1.EventTypeWarning, "DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.messaging.knative.dev "dlc" not found`),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{{
Object: NewSubscription(subscriptionName, testNS,
Expand All @@ -487,7 +487,7 @@ func TestAllCases(t *testing.T) {
WithSubscriptionDeliveryRef(subscriberGVK, dlcName, testNS),
// The first reconciliation will initialize the status conditions.
WithInitSubscriptionConditions,
WithSubscriptionReferencesNotResolved("DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.eventing.knative.dev "dlc" not found`),
WithSubscriptionReferencesNotResolved("DeadLetterSinkResolveFailed", `Failed to resolve spec.delivery.deadLetterSink: subscribers.messaging.knative.dev "dlc" not found`),
WithSubscriptionPhysicalSubscriptionSubscriber(subscriberURI),
),
}},
Expand Down

0 comments on commit b94401f

Please sign in to comment.