Skip to content

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 requested review from elsony and yangcao77 December 2, 2021 18:58
@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


//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

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

@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

Development

Successfully merging this pull request may close these issues.

3 participants