-
Notifications
You must be signed in to change notification settings - Fork 600
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
Add sources metadata conformance test #3363
Add sources metadata conformance test #3363
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
test/e2e_flags.go
Outdated
@@ -35,6 +35,9 @@ const ( | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until we have knative/pkg#1424 available, let's go w/ this
/assign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit
test/flags/sources.go
Outdated
return nil | ||
} | ||
|
||
// Check if the Source name is valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Check if the Source name is valid. | |
// Check if the Source kind is valid. |
test/flags/sources.go
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be extracted into a separate function and can be reused in sources.go and channels.go. ...if you feel for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, on it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
test/flags/channels.go
Outdated
@@ -27,28 +26,15 @@ import ( | |||
// Channels holds the Channels we want to run test against. | |||
type Channels []metav1.TypeMeta | |||
|
|||
var objs []metav1.TypeMeta |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused var?
@@ -35,6 +35,6 @@ initialize $@ --skip-istio-addon | |||
install_mt_broker || fail_test "Could not install MT Channel Based Broker" | |||
|
|||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
w00t!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Looks great!
Hopefully green on first pass 😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
/assign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[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
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #3116
Proposed Changes
-sources
e2e testing flagRelease Note