Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
Prefix PullSubscription and Topic testing functions with PubSub (#989)
Browse files Browse the repository at this point in the history
* Prefix PullSubscription and Topic functions with PubSub.

This is being done because the intevents version will soon need the same functions and will be given the non-prefixed names (as they will continue to exist past the next release).

* Listers too.
  • Loading branch information
Harwayne authored May 6, 2020
1 parent 2ce8014 commit 218ea15
Show file tree
Hide file tree
Showing 15 changed files with 1,115 additions and 1,168 deletions.
228 changes: 114 additions & 114 deletions pkg/reconciler/events/auditlogs/auditlogs_test.go

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions pkg/reconciler/events/build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,22 @@ func TestAllCases(t *testing.T) {
),
}},
WantCreates: []runtime.Object{
NewPullSubscriptionWithNoDefaults(buildName, testNS,
WithPullSubscriptionSpecWithNoDefaults(pubsubv1alpha1.PullSubscriptionSpec{
NewPubSubPullSubscriptionWithNoDefaults(buildName, testNS,
WithPubSubPullSubscriptionSpecWithNoDefaults(pubsubv1alpha1.PullSubscriptionSpec{
Topic: testTopicID,
PubSubSpec: duckv1alpha1.PubSubSpec{
Secret: &secret,
},
}),
WithPullSubscriptionSink(sinkGVK, sinkName),
WithPullSubscriptionLabels(map[string]string{
WithPubSubPullSubscriptionSink(sinkGVK, sinkName),
WithPubSubPullSubscriptionLabels(map[string]string{
"receive-adapter": receiveAdapterName,
"events.cloud.google.com/source-name": buildName,
}),
WithPullSubscriptionAnnotations(map[string]string{
WithPubSubPullSubscriptionAnnotations(map[string]string{
"metrics-resource-group": resourceGroup,
}),
WithPullSubscriptionOwnerReferences([]metav1.OwnerReference{ownerRef()}),
WithPubSubPullSubscriptionOwnerReferences([]metav1.OwnerReference{ownerRef()}),
),
},
WantPatches: []clientgotesting.PatchActionImpl{
Expand All @@ -199,8 +199,8 @@ func TestAllCases(t *testing.T) {
WithCloudBuildSourceTopic(testTopicID),
WithCloudBuildSourceSink(sinkGVK, sinkName),
),
NewPullSubscriptionWithNoDefaults(buildName, testNS,
WithPullSubscriptionReadyStatus(corev1.ConditionFalse, "PullSubscriptionFalse", "status false test message")),
NewPubSubPullSubscriptionWithNoDefaults(buildName, testNS,
WithPubSubPullSubscriptionReadyStatus(corev1.ConditionFalse, "PullSubscriptionFalse", "status false test message")),
newSink(),
},
Key: testNS + "/" + buildName,
Expand Down Expand Up @@ -230,8 +230,8 @@ func TestAllCases(t *testing.T) {
WithCloudBuildSourceTopic(testTopicID),
WithCloudBuildSourceSink(sinkGVK, sinkName),
),
NewPullSubscriptionWithNoDefaults(buildName, testNS,
WithPullSubscriptionReadyStatus(corev1.ConditionUnknown, "PullSubscriptionUnknown", "status unknown test message")),
NewPubSubPullSubscriptionWithNoDefaults(buildName, testNS,
WithPubSubPullSubscriptionReadyStatus(corev1.ConditionUnknown, "PullSubscriptionUnknown", "status unknown test message")),
newSink(),
},
Key: testNS + "/" + buildName,
Expand Down Expand Up @@ -261,9 +261,9 @@ func TestAllCases(t *testing.T) {
WithCloudBuildSourceTopic(testTopicID),
WithCloudBuildSourceSink(sinkGVK, sinkName),
),
NewPullSubscriptionWithNoDefaults(buildName, testNS,
WithPullSubscriptionReady(sinkURI),
WithPullSubscriptionReadyStatus(corev1.ConditionTrue, "PullSubscriptionNoReady", ""),
NewPubSubPullSubscriptionWithNoDefaults(buildName, testNS,
WithPubSubPullSubscriptionReady(sinkURI),
WithPubSubPullSubscriptionReadyStatus(corev1.ConditionTrue, "PullSubscriptionNoReady", ""),
),
newSink(),
},
Expand Down Expand Up @@ -342,7 +342,7 @@ func TestAllCases(t *testing.T) {
PubSubBase: pubsub.NewPubSubBase(ctx, controllerAgentName, receiveAdapterName, cmw),
Identity: identity.NewIdentity(ctx, NoopIAMPolicyManager),
buildLister: listers.GetCloudBuildSourceLister(),
pullsubscriptionLister: listers.GetPullSubscriptionLister(),
pullsubscriptionLister: listers.GetPubSubPullSubscriptionLister(),
serviceAccountLister: listers.GetServiceAccountLister(),
}
return cloudbuildsource.NewReconciler(ctx, r.Logger, r.RunClientSet, listers.GetCloudBuildSourceLister(), r.Recorder, r)
Expand Down
30 changes: 15 additions & 15 deletions pkg/reconciler/events/pubsub/pubsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,23 @@ func TestAllCases(t *testing.T) {
),
}},
WantCreates: []runtime.Object{
NewPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPullSubscriptionSpecWithNoDefaults(pubsubv1alpha1.PullSubscriptionSpec{
NewPubSubPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPubSubPullSubscriptionSpecWithNoDefaults(pubsubv1alpha1.PullSubscriptionSpec{
Topic: testTopicID,
PubSubSpec: duckv1alpha1.PubSubSpec{
Secret: &secret,
},
}),
WithPullSubscriptionSink(sinkGVK, sinkName),
WithPullSubscriptionMode(pubsubv1alpha1.ModePushCompatible),
WithPullSubscriptionLabels(map[string]string{
WithPubSubPullSubscriptionSink(sinkGVK, sinkName),
WithPubSubPullSubscriptionMode(pubsubv1alpha1.ModePushCompatible),
WithPubSubPullSubscriptionLabels(map[string]string{
"receive-adapter": receiveAdapterName,
"events.cloud.google.com/source-name": pubsubName,
}),
WithPullSubscriptionAnnotations(map[string]string{
WithPubSubPullSubscriptionAnnotations(map[string]string{
"metrics-resource-group": resourceGroup,
}),
WithPullSubscriptionOwnerReferences([]metav1.OwnerReference{ownerRef()}),
WithPubSubPullSubscriptionOwnerReferences([]metav1.OwnerReference{ownerRef()}),
),
},
WantPatches: []clientgotesting.PatchActionImpl{
Expand All @@ -198,8 +198,8 @@ func TestAllCases(t *testing.T) {
WithCloudPubSubSourceTopic(testTopicID),
WithCloudPubSubSourceSink(sinkGVK, sinkName),
),
NewPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPullSubscriptionReadyStatus(corev1.ConditionFalse, "PullSubscriptionFalse", "status false test message")),
NewPubSubPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPubSubPullSubscriptionReadyStatus(corev1.ConditionFalse, "PullSubscriptionFalse", "status false test message")),
newSink(),
},
Key: testNS + "/" + pubsubName,
Expand Down Expand Up @@ -229,8 +229,8 @@ func TestAllCases(t *testing.T) {
WithCloudPubSubSourceTopic(testTopicID),
WithCloudPubSubSourceSink(sinkGVK, sinkName),
),
NewPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPullSubscriptionReadyStatus(corev1.ConditionUnknown, "PullSubscriptionUnknown", "status unknown test message")),
NewPubSubPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPubSubPullSubscriptionReadyStatus(corev1.ConditionUnknown, "PullSubscriptionUnknown", "status unknown test message")),
newSink(),
},
Key: testNS + "/" + pubsubName,
Expand Down Expand Up @@ -260,9 +260,9 @@ func TestAllCases(t *testing.T) {
WithCloudPubSubSourceTopic(testTopicID),
WithCloudPubSubSourceSink(sinkGVK, sinkName),
),
NewPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPullSubscriptionReady(sinkURI),
WithPullSubscriptionReadyStatus(corev1.ConditionTrue, "PullSubscriptionNoReady", ""),
NewPubSubPullSubscriptionWithNoDefaults(pubsubName, testNS,
WithPubSubPullSubscriptionReady(sinkURI),
WithPubSubPullSubscriptionReadyStatus(corev1.ConditionTrue, "PullSubscriptionNoReady", ""),
),
newSink(),
},
Expand Down Expand Up @@ -341,7 +341,7 @@ func TestAllCases(t *testing.T) {
PubSubBase: pubsub.NewPubSubBase(ctx, controllerAgentName, receiveAdapterName, cmw),
Identity: identity.NewIdentity(ctx, NoopIAMPolicyManager),
pubsubLister: listers.GetCloudPubSubSourceLister(),
pullsubscriptionLister: listers.GetPullSubscriptionLister(),
pullsubscriptionLister: listers.GetPubSubPullSubscriptionLister(),
serviceAccountLister: listers.GetServiceAccountLister(),
}
return cloudpubsubsource.NewReconciler(ctx, r.Logger, r.RunClientSet, listers.GetCloudPubSubSourceLister(), r.Recorder, r)
Expand Down
Loading

0 comments on commit 218ea15

Please sign in to comment.