Skip to content

Commit

Permalink
Skip channel conformance tests for spec.subscriber for generic Channel
Browse files Browse the repository at this point in the history
  • Loading branch information
aliok committed May 14, 2020
1 parent ad7673e commit 0041836
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 12 additions & 0 deletions test/conformance/helpers/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ import (
eventingduckv1beta1 "knative.dev/eventing/pkg/apis/duck/v1beta1"
)

var (
channelv1alpha1 = metav1.TypeMeta{
Kind: "Channel",
APIVersion: "messaging.knative.dev/v1alpha1",
}

channelv1beta1 = metav1.TypeMeta{
Kind: "Channel",
APIVersion: "messaging.knative.dev/v1beta1",
}
)

func getChannelDuckTypeSupportVersion(channelName string, client *lib.Client, channel *metav1.TypeMeta) (string, error) {
metaResource := resources.NewMetaResource(channelName, client.Namespace, channel)
obj, err := duck.GetGenericObject(client.Dynamic, metaResource, &eventingduckv1beta1.Channelable{})
Expand Down
9 changes: 6 additions & 3 deletions test/conformance/helpers/channel_spec_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,23 @@ func ChannelSpecTestHelperWithChannelTestRunner(
defer lib.TearDown(client)

t.Run("Channel spec allows subscribers", func(t *testing.T) {
channelSpecAllowsRequiredFields(st, client, channel)
if channel == channelv1alpha1 || channel == channelv1beta1 {
t.Skip("Not running spec.subscribers array test for generic Channel")
}
channelSpecAllowsSubscribersArray(st, client, channel)
})
})
}

func channelSpecAllowsRequiredFields(st *testing.T, client *lib.Client, channel metav1.TypeMeta, options ...lib.SetupClientOption) {
func channelSpecAllowsSubscribersArray(st *testing.T, client *lib.Client, channel metav1.TypeMeta, options ...lib.SetupClientOption) {
st.Logf("Running channel spec conformance test with channel %q", channel)

dtsv, err := getChannelDuckTypeSupportVersionFromTypeMeta(client, channel)
if err != nil {
st.Fatalf("Unable to check Channel duck type support version for %q: %q", channel, err)
}

channelName := names.SimpleNameGenerator.GenerateName("channel-spec-req-fields-")
channelName := names.SimpleNameGenerator.GenerateName("channel-spec-subscribers-")
client.T.Logf("Creating channel %+v-%s", channel, channelName)
client.CreateChannelOrFail(channelName, &channel)
client.WaitForResourceReadyOrFail(channelName, &channel)
Expand Down

0 comments on commit 0041836

Please sign in to comment.