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

Do not fail when subscription already exists #3776

Merged
merged 1 commit into from
Aug 5, 2020
Merged
Changes from all commits
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
44 changes: 22 additions & 22 deletions test/lib/creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (c *Client) CreateChannelOrFail(name string, channelTypeMeta *metav1.TypeMe
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create %q %q: %v", channelTypeMeta.Kind, name, err)
}
c.Tracker.Add(gvr.Group, gvr.Version, gvr.Resource, namespace, name)
Expand All @@ -111,7 +111,7 @@ func (c *Client) CreateChannelWithDefaultOrFail(channel *messagingv1beta1.Channe
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create channel %q: %v", channel.Name, err)
}
c.Tracker.AddObj(channel)
Expand All @@ -128,7 +128,7 @@ func (c *Client) CreateChannelV1WithDefaultOrFail(channel *messagingv1.Channel)
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create channel %q: %v", channel.Name, err)
}
c.Tracker.AddObj(channel)
Expand All @@ -154,7 +154,7 @@ func (c *Client) CreateSubscriptionOrFail(
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create subscription %q: %v", name, err)
}
c.Tracker.AddObj(retSubscription)
Expand All @@ -181,7 +181,7 @@ func (c *Client) CreateSubscriptionV1OrFail(
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create subscription %q: %v", name, err)
}
c.Tracker.AddObj(retSubscription)
Expand Down Expand Up @@ -266,7 +266,7 @@ func (c *Client) CreateBrokerV1Beta1OrFail(name string, options ...resources.Bro
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create v1beta1 broker %q: %v", name, err)
}
c.Tracker.AddObj(retBroker)
Expand All @@ -290,7 +290,7 @@ func (c *Client) CreateTriggerOrFailV1Beta1(name string, options ...resources.Tr
return e
})

if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create v1beta1 trigger %q: %v", name, err)
}
c.Tracker.AddObj(retTrigger)
Expand All @@ -313,7 +313,7 @@ func (c *Client) CreateBrokerV1OrFail(name string, options ...resources.BrokerV1
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create v1 broker %q: %v", name, err)
}
c.Tracker.AddObj(retBroker)
Expand All @@ -336,7 +336,7 @@ func (c *Client) CreateTriggerV1OrFail(name string, options ...resources.Trigger
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create v1 trigger %q: %v", name, err)
}
c.Tracker.AddObj(retTrigger)
Expand All @@ -355,7 +355,7 @@ func (c *Client) CreateFlowsSequenceOrFail(sequence *flowsv1beta1.Sequence) {
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create flows sequence %q: %v", sequence.Name, err)
}
c.Tracker.AddObj(sequence)
Expand All @@ -373,7 +373,7 @@ func (c *Client) CreateFlowsSequenceV1OrFail(sequence *flowsv1.Sequence) {
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create flows sequence %q: %v", sequence.Name, err)
}
c.Tracker.AddObj(sequence)
Expand All @@ -391,7 +391,7 @@ func (c *Client) CreateFlowsParallelOrFail(parallel *flowsv1beta1.Parallel) {
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create flows parallel %q: %v", parallel.Name, err)
}
c.Tracker.AddObj(parallel)
Expand All @@ -409,7 +409,7 @@ func (c *Client) CreateFlowsParallelV1OrFail(parallel *flowsv1.Parallel) {
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create flows parallel %q: %v", parallel.Name, err)
}
c.Tracker.AddObj(parallel)
Expand All @@ -426,7 +426,7 @@ func (c *Client) CreateSinkBindingV1Alpha1OrFail(sb *sourcesv1alpha1.SinkBinding
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create sinkbinding %q: %v", sb.Name, err)
}
c.Tracker.AddObj(sb)
Expand All @@ -443,7 +443,7 @@ func (c *Client) CreateSinkBindingV1Alpha2OrFail(sb *sourcesv1alpha2.SinkBinding
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create sinkbinding %q: %v", sb.Name, err)
}
c.Tracker.AddObj(sb)
Expand All @@ -460,7 +460,7 @@ func (c *Client) CreateSinkBindingV1Beta1OrFail(sb *sourcesv1beta1.SinkBinding)
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create sinkbinding %q: %v", sb.Name, err)
}
c.Tracker.AddObj(sb)
Expand All @@ -477,7 +477,7 @@ func (c *Client) CreateApiServerSourceV1Alpha2OrFail(apiServerSource *sourcesv1a
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create apiserversource %q: %v", apiServerSource.Name, err)
}
c.Tracker.AddObj(apiServerSource)
Expand All @@ -494,7 +494,7 @@ func (c *Client) CreateApiServerSourceV1Beta1OrFail(apiServerSource *sourcesv1be
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create apiserversource %q: %v", apiServerSource.Name, err)
}
c.Tracker.AddObj(apiServerSource)
Expand All @@ -511,7 +511,7 @@ func (c *Client) CreateContainerSourceV1Alpha2OrFail(containerSource *sourcesv1a
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create containersource %q: %v", containerSource.Name, err)
}
c.Tracker.AddObj(containerSource)
Expand All @@ -528,7 +528,7 @@ func (c *Client) CreateContainerSourceV1Beta1OrFail(containerSource *sourcesv1be
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create containersource %q: %v", containerSource.Name, err)
}
c.Tracker.AddObj(containerSource)
Expand All @@ -545,7 +545,7 @@ func (c *Client) CreatePingSourceV1Alpha1OrFail(pingSource *sourcesv1alpha1.Ping
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create pingsource %q: %v", pingSource.Name, err)
}
c.Tracker.AddObj(pingSource)
Expand All @@ -562,7 +562,7 @@ func (c *Client) CreatePingSourceV1Alpha2OrFail(pingSource *sourcesv1alpha2.Ping
}
return e
})
if err != nil {
if err != nil && !errors.IsAlreadyExists(err) {
c.T.Fatalf("Failed to create pingsource %q: %v", pingSource.Name, err)
}
c.Tracker.AddObj(pingSource)
Expand Down