Add sources metadata conformance test#3363
Conversation
mattmoor
left a comment
There was a problem hiding this comment.
Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)
goimports -w $(find -name '*.go' | grep -v vendor | grep -v third_party | grep -v wire_gen.go)
| BrokerUsage = "Which brokerclass to test, requires the proper Broker " + | ||
| "implementation to have been installed, and only one value. brokerclass " + | ||
| "must be (for now) 'MTChannelBasedBroker'." | ||
| SourceUsage = "The names of the source type metas, separated by comma. " + |
There was a problem hiding this comment.
Format Go code:
| SourceUsage = "The names of the source type metas, separated by comma. " + | |
| SourceUsage = "The names of the source type metas, separated by comma. " + |
| ) | ||
|
|
||
| var sourceLabels = map[string]string{ | ||
| "duck.knative.dev/source": "true", |
There was a problem hiding this comment.
until we have knative/pkg#1424 available, let's go w/ this
|
/assign |
| return nil | ||
| } | ||
|
|
||
| // Check if the Source name is valid. |
There was a problem hiding this comment.
| // Check if the Source name is valid. | |
| // Check if the Source kind is valid. |
| for _, source := range strings.Split(value, ",") { | ||
| source := strings.TrimSpace(source) | ||
| split := strings.Split(source, ":") | ||
| if len(split) != 2 { | ||
| log.Fatalf("The given Source name %q is invalid, it needs to be in the form \"apiVersion:Kind\".", source) | ||
| } | ||
| tm := metav1.TypeMeta{ | ||
| APIVersion: split[0], | ||
| Kind: split[1], | ||
| } | ||
| if !isValidSource(tm.Kind) { | ||
| log.Fatalf("The given Source name %q is invalid, tests cannot be run.\n", source) | ||
| } | ||
|
|
||
| *sources = append(*sources, tm) | ||
| } | ||
| return nil | ||
| } |
There was a problem hiding this comment.
This can be extracted into a separate function and can be reused in sources.go and channels.go. ...if you feel for it
aliok
left a comment
There was a problem hiding this comment.
Can you also update the test script so that it runs the conformance tests against the sources defined in knative/eventing?
I see following line in the logs:
Running tests with 'go test -v -race -count=1 -tags=e2e -timeout=20m -parallel=12 ./test/e2e ./test/conformance -brokerclass=MTChannelBasedBroker -channels=messaging.knative.dev/v1beta1:Channel,messaging.knative.dev/v1beta1:InMemoryChannel '
no sources mentioned there.
| // Channels holds the Channels we want to run test against. | ||
| type Channels []metav1.TypeMeta | ||
|
|
||
| var objs []metav1.TypeMeta |
|
|
||
| echo "Running tests with Multi Tenant Channel Based Broker" | ||
| go_test_e2e -timeout=20m -parallel=12 ./test/e2e ./test/conformance -brokerclass=MTChannelBasedBroker -channels=messaging.knative.dev/v1beta1:Channel,messaging.knative.dev/v1beta1:InMemoryChannel || fail_test | ||
| go_test_e2e -timeout=20m -parallel=12 ./test/e2e ./test/conformance -brokerclass=MTChannelBasedBroker -channels=messaging.knative.dev/v1beta1:Channel,messaging.knative.dev/v1beta1:InMemoryChannel -sources=sources.knative.dev/v1alpha2:ApiServerSource,sources.knative.dev/v1alpha2:ContainerSource,sources.knative.dev/v1alpha2:PingSource || fail_test |
aliok
left a comment
There was a problem hiding this comment.
/lgtm
/approve
Looks great!
Hopefully green on first pass 😎
|
/assign |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Abd4llA, aliok, slinkydeveloper The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #3116
Proposed Changes
-sourcese2e testing flagRelease Note