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

Version checks for boolean properties #126

Merged
merged 4 commits into from
Dec 7, 2021

Conversation

kim-tsao
Copy link
Contributor

@kim-tsao kim-tsao commented Dec 2, 2021

What does this PR do?:

Adds a version check when setting defaults for the ephemeral property

Which issue(s) this PR fixes:

devfile/api#697

PR acceptance criteria:

Testing and documentation do not need to be complete in order for this PR to be approved. We just need to ensure tracking issues are opened.

  • Open new test/doc issues under the devfile/api repo
  • Check each criteria if:
  • There is a separate tracking issue. Add the issue link under the criteria
    or
  • test/doc updates are made as part of this PR
  • If unchecked, explain why it's not needed
  • Unit/Functional tests

The functional tests only cover what's fixed in the defect. Additional coverage will be handled in this issue devfile/api#655

How to test changes / Special notes to the reviewer:

build a new odo binary and run the scenario detailed in devfile/api#697

@openshift-ci openshift-ci bot added the approved label Dec 2, 2021
@kim-tsao kim-tsao marked this pull request as ready for review December 2, 2021 20:00
@kim-tsao kim-tsao requested review from maysunfaisal and removed request for elsony December 2, 2021 20:00
@feloy
Copy link
Contributor

feloy commented Dec 3, 2021

This patch fixes the issue raised in #697. Thanks @kim-tsao

Copy link
Collaborator

@yangcao77 yangcao77 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 the change Kim. besides the comment I put below, can you also add unit tests for setDefaults() and the new function,verifyEphemeralUnset(), introduced by this PR?
we want to have new functions also covered by unit tests

@@ -478,6 +478,7 @@ func convertDevWorskapceTemplateToDevObj(dwTemplate v1.DevWorkspaceTemplate) (d

//setDefaults sets the default values for nil boolean properties after the merging of devWorkspaceTemplateSpec is complete
func setDefaults(d DevfileObj) (err error) {
schemaVersion := d.Data.GetSchemaVersion()
Copy link
Collaborator

Choose a reason for hiding this comment

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

DevfileObj.Ctx.GetApiVersion() should take higher priority than Data.GetSchemaVersion().

	if devfileVersion = DevfileObj.Ctx.GetApiVersion(); devfileVersion == "" {
		devfileVersion = DevfileObj.Data.GetSchemaVersion()
	}

@kim-tsao
Copy link
Contributor Author

kim-tsao commented Dec 7, 2021

thanks for the change Kim. besides the comment I put below, can you also add unit tests for setDefaults() and the new function,verifyEphemeralUnset(), introduced by this PR? we want to have new functions also covered by unit tests

verifyEphemeralUnset() is just a new function in our test utils. I added unit tests for setDefaults() - it was a worthwhile effort since I found and fixed a bug related to setting defaults on dedicatedPod and mountSources. I also cleaned up some error handling that was missed.

Copy link
Collaborator

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

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

Changes lgtm

@openshift-ci openshift-ci bot added the lgtm label Dec 7, 2021
@openshift-ci
Copy link

openshift-ci bot commented Dec 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kim-tsao, yangcao77

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

@kim-tsao kim-tsao merged commit de570f0 into devfile:main Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants