-
Notifications
You must be signed in to change notification settings - Fork 243
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
Use map for runningIn instead of array in JSON output #6094
Conversation
✅ Deploy Preview for odo-docusaurus-preview canceled.
|
2755cb7
to
9d72e39
Compare
helper.JsonPathContentContain(stdout, "components.0.runningIn.#", "1") | ||
helper.JsonPathContentContain(stdout, "components.0.runningIn.0", "Dev") | ||
helper.JsonPathContentContain(stdout, "components.0.runningIn.dev", "true") | ||
helper.JsonPathContentContain(stdout, "components.0.runningIn.deploy", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I find this check confusing. If the component is not running in Deploy mode, "deploy" will not appear in the list, why then check for it to be an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JsonPathContentContain
function is not able to make a difference between is the field is not defined or if the field is empty.
This test is used to check that the field is not defined
Re-run with new tests names |
pkg/api/component.go
Outdated
"strings" | ||
) | ||
|
||
type RunningMode string | ||
type RunningModeList []RunningMode | ||
type RunningModeList map[string]bool | ||
|
||
const ( | ||
RunningModeDev RunningMode = "Dev" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see that those constants (and the RunningMode
type) are no longer used and could be removed.
pkg/api/component.go
Outdated
strs = append(strs, string(s)) | ||
for s, v := range o { | ||
if v { | ||
strs = append(strs, string(strings.Title(s))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strings.Title
already returns a string
, so the additional type conversion does not seem needed.
@@ -157,7 +157,9 @@ odo describe component -o json | |||
"containerPort": 3000 | |||
} | |||
], | |||
"runningIn": ["Dev"], | |||
"runningIn": { | |||
"dev": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature-wise, I was expecting the list of possible running modes to be exposed, instead of just the current running mode.
From what I understand from this comment:
menu to start dev mode is enabled if devfile has dev support and if dev mode is not running for the component.
If devfile has dev support but dev mode is not running for the component, I think odo describe component -o json
should have "dev": false
reported in the running mode object, to help to parse that information. No?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. Writing the doc, I was thinking it was due to the omitempty
nature of the marshalling in Go, but it is not the case, because it is a map. I'll make the changes to add by default all the keys with a False value
9d72e39
to
c43d99c
Compare
c43d99c
to
289c742
Compare
Thanks @dharmit for your review |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rm3l 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 |
/lgtm |
/override ci/prow/v4.10-integration-e2e |
@feloy: Overrode contexts on behalf of feloy: ci/prow/v4.10-integration-e2e In response to this:
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. |
/override ci/prow/v4.10-integration-e2e All tests passed, but not recognized by Github
|
@feloy: Overrode contexts on behalf of feloy: Kubernetes-Integration-Tests/Kubernetes-Integration-Tests, OpenShift-Integration-tests/OpenShift-Integration-tests, Unit-Tests/Unit-Tests, ci/prow/v4.10-integration-e2e In response to this:
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. |
What type of PR is this:
/kind bug
What does this PR do / why we need it:
Which issue(s) this PR fixes:
Fixes #5999
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer: