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

add keyset length check #277

Merged
merged 2 commits into from
Dec 11, 2020
Merged

Conversation

yangcao77
Copy link
Contributor

Signed-off-by: Stephanie [email protected]

What does this PR do?

should not assume the keyset length
add keyset length check before access keyset[0] and keyset[1]

What issues does this PR fix or reference?

fixes #276

Is your PR tested? Consider putting some instruction how to test your changes

tested with parser unit test

Signed-off-by: Stephanie <[email protected]>
Copy link
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -116,6 +116,9 @@ func OverrideDevWorkspaceTemplateSpec(original *workspaces.DevWorkspaceTemplateS

func ensureOnlyExistingElementsAreOverridden(spec *workspaces.DevWorkspaceTemplateSpecContent, overrides workspaces.Overrides) error {
return checkKeys(func(elementType string, keysSets []sets.String) []error {
if len(keysSets) <= 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Totally optional nit

Suggested change
if len(keysSets) <= 1 {
if len(keysSets) < 2 {

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: amisevsk, yangcao77
To complete the pull request process, please assign after the PR has been reviewed.
You can assign the PR to them by writing /assign in a comment when ready.

The full list of commands accepted by this bot can be found 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

override checkkeys should not assume there is a matching key in the override patch
3 participants