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

Bug 1925024: removes form validation from net(sasl/tls) section for kafkaSource #8051

Merged
merged 1 commit into from Feb 4, 2021

Conversation

invincibleJai
Copy link
Member

@invincibleJai invincibleJai commented Feb 4, 2021

Fixes:
https://issues.redhat.com/browse/ODC-5458

Analysis / Root cause:
In form view for kafksSource if sasl/tls are enebled then other fields i.e user , password or caCert, cert, key where shown as required field which shouldn't be the case

Solution Description:
Removed required validation from net section and rely on API validation for same

Screen shots / Gifs for design review:

image

Test:

image

Test setup:

  • Install Serverless operator
  • create CR for Knative Kafka (enable source) along with serving and eventing

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added component/knative Related to knative-plugin approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 4, 2021
@invincibleJai invincibleJai changed the title removes form validation from net(sasl/tls) section for kafkaSource Bug 1925024: removes form validation from net(sasl/tls) section for kafkaSource Feb 4, 2021
@openshift-ci-robot
Copy link
Contributor

@invincibleJai: This pull request references Bugzilla bug 1925024, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state NEW, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1925024: removes form validation from net(sasl/tls) section for kafkaSource

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Feb 4, 2021
@karthikjeeyar
Copy link
Contributor

We could add a test spec against the net section

    it('should not throw error if net section is empty', async () => {
      const defaultEventingData = getDefaultEventingData(EventSources.KafkaSource);
      const mockData = _.cloneDeep(defaultEventingData);
      delete mockData.formData.data.KafkaSource.net;
      await eventSourceValidationSchema(t)
        .resolve({ value: mockData })
        .isValid(mockData)
        .then((valid) => expect(valid).toEqual(true));
    });

@openshift-ci-robot
Copy link
Contributor

@invincibleJai: This pull request references Bugzilla bug 1925024, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.7.0) matches configured target release for branch (4.7.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

Bug 1925024: removes form validation from net(sasl/tls) section for kafkaSource

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

expect(
isSecretKeyRefPresent({ secretKeyRef: { name: 'my-sasl-secret', key: '' } }),
).toBeTruthy();
expect(isSecretKeyRefPresent({ secretKeyRef: { name: '', key: 'user' } })).toBeTruthy();
Copy link
Contributor

Choose a reason for hiding this comment

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

When asserting against a exact boolean value we should go for .toBe(true) or .toBe(false).

see this - https://jestjs.io/docs/en/expect#tobetruthy

In JavaScript, there are six falsy values: false, 0, '', null, undefined, and NaN. Everything else is truthy.

});

it('expect false if secretKeyRef is not there for name and key', () => {
expect(isSecretKeyRefPresent({ secretKeyRef: { name: '', key: '' } })).toBeFalsy();
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

@@ -297,4 +299,83 @@ describe('sanitizeSourceToForm always returns valid Event Source', () => {
expect(formData.application.name).toEqual('');
expect(formData.application.selectedKey).toEqual(UNASSIGNED_KEY);
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Pls Add the null test as well

Suggested change
expect(isSecretKeyRefPresent(null)).toBe(false);

Copy link
Member Author

Choose a reason for hiding this comment

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

added

@karthikjeeyar
Copy link
Contributor

Verified locally, works fine
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2021
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: invincibleJai, karthikjeeyar

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 00e9537 into openshift:master Feb 4, 2021
@openshift-ci-robot
Copy link
Contributor

@invincibleJai: All pull requests linked via external trackers have merged:

Bugzilla bug 1925024 has been moved to the MODIFIED state.

In response to this:

Bug 1925024: removes form validation from net(sasl/tls) section for kafkaSource

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.7 milestone Feb 5, 2021
@invincibleJai
Copy link
Member Author

/cherry-pick release-4.6

@openshift-cherrypick-robot

@invincibleJai: #8051 failed to apply on top of branch "release-4.6":

Applying: removes form validation from net(sasl/tls) section for kafkaSource
Using index info to reconstruct a base tree...
M	frontend/packages/knative-plugin/src/components/add/__tests__/eventSource-validation-utils.spec.ts
M	frontend/packages/knative-plugin/src/components/add/eventSource-validation-utils.ts
M	frontend/packages/knative-plugin/src/utils/__tests__/create-eventsources-utils.spec.ts
M	frontend/packages/knative-plugin/src/utils/create-eventsources-utils.ts
Falling back to patching base and 3-way merge...
Auto-merging frontend/packages/knative-plugin/src/utils/create-eventsources-utils.ts
CONFLICT (content): Merge conflict in frontend/packages/knative-plugin/src/utils/create-eventsources-utils.ts
Auto-merging frontend/packages/knative-plugin/src/utils/__tests__/create-eventsources-utils.spec.ts
CONFLICT (content): Merge conflict in frontend/packages/knative-plugin/src/utils/__tests__/create-eventsources-utils.spec.ts
Auto-merging frontend/packages/knative-plugin/src/components/add/eventSource-validation-utils.ts
CONFLICT (content): Merge conflict in frontend/packages/knative-plugin/src/components/add/eventSource-validation-utils.ts
Auto-merging frontend/packages/knative-plugin/src/components/add/__tests__/eventSource-validation-utils.spec.ts
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 removes form validation from net(sasl/tls) section for kafkaSource
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/knative Related to knative-plugin lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants