Skip to content

Add E2E test for default channel#1782

Merged
knative-prow-robot merged 3 commits into
knative:masterfrom
chizhg:AddChannelDefaulterTest
Sep 6, 2019
Merged

Add E2E test for default channel#1782
knative-prow-robot merged 3 commits into
knative:masterfrom
chizhg:AddChannelDefaulterTest

Conversation

@chizhg
Copy link
Copy Markdown
Contributor

@chizhg chizhg commented Aug 30, 2019

Fixes #1711

Proposed Changes

  • Add E2E test for default Channel. The E2E test covers the cluster-wide and namespace-wide defaulters.

Release Note

NONE

/cc @nachocano

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Aug 30, 2019
@knative-prow-robot knative-prow-robot added area/test-and-release Test infrastructure, tests or release size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 30, 2019
@chizhg chizhg changed the title Add channel defaulter test Add E2E test for default channel Aug 30, 2019
defaultChannelConfig, hasDefault := configMap.Data[channelDefaulterKey]
config := &defaultchannel.Config{}
if hasDefault {
if err := yaml.Unmarshal([]byte(defaultChannelConfig), config); err != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look at the channelDefaulter.UpdateConfigMap... we are converting the yaml to json, and then doing some update there... I think there was a problem with the casing of the keys otherwise...
BTW, is that something we can call, instead of duplicating the logic here? If not, no worries...

Copy link
Copy Markdown
Contributor Author

@chizhg chizhg Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to update the configmap ref first, then call the UpdateConfigMap method, and seems we don't have existed code doing the former.
And I feel the channelDefaulter is more for internal implementation, the only interesting thing to end user is the configmap itself.
So I didn't change anything here..

Comment thread test/common/creation.go Outdated

// updateDefaultChannelCM will update the default channel configmap
func updateDefaultChannelCM(client *common.Client, updateConfig func(config *defaultchannel.Config)) error {
systemNamespace := resources.SystemNamespace
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to do all these programmatic reading and updating of the configMap? and then call the defaulter UpdateConfigMap? Can't you just create a ConfigMap object in memory and set the appropriate value to a key in the Data field?
No need to do it now, but maybe when you add the thread-safety thing...

Copy link
Copy Markdown
Contributor Author

@chizhg chizhg Sep 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I can do that, but I think we still cannot get rid of the yaml.Unmarshal and yaml.Marshal stuff, since it's not safe to directly change yaml, even in test.

@nachocano
Copy link
Copy Markdown
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 3, 2019
@chizhg
Copy link
Copy Markdown
Contributor Author

chizhg commented Sep 3, 2019

/cc @grantr
for approval.
Thanks!

Copy link
Copy Markdown
Contributor

@grantr grantr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this test @Fredy-Z!

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Fredy-Z, grantr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 6, 2019
@knative-prow-robot knative-prow-robot merged commit 6a4539f into knative:master Sep 6, 2019
@chizhg chizhg deleted the AddChannelDefaulterTest branch September 11, 2019 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test-and-release Test infrastructure, tests or release cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add E2E test for channel default logic

5 participants