-
Notifications
You must be signed in to change notification settings - Fork 244
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
Refactor odo exec integration tests + remove unused utils functions #5049
Refactor odo exec integration tests + remove unused utils functions #5049
Conversation
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.
Apart from a few nitty-gritty changes, this looks good to me.
Do you think you can also accommodate a test for #5012 ?
args := []string{"create", "nodejs", cmpName, "--context", commonVar.Context} | ||
helper.Cmd("odo", args...).ShouldPass() | ||
helper.CopyExample(filepath.Join("source", "devfiles", "nodejs", "project"), commonVar.Context) | ||
helper.CopyExampleDevFile(filepath.Join("source", "devfiles", "nodejs", "devfile.yaml"), filepath.Join(commonVar.Context, "devfile.yaml")) |
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.
Do we need to copy this devfile? Won't the devfile created by running odo create
be enough?
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.
It seems the PROJECTS_ROOT definition in the devfile.yaml is important. Some tests fail without copying this devfile.
It("should error out when a invalid command is given by the user", func() { | ||
utils.ExecWithInvalidCommand(commonVar.Context, cmpName, "kube") | ||
It("should error out when a component is not present or when a devfile flag is used", func() { | ||
args := []string{"exec", "--context", commonVar.Context} |
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 think something like the following would make sense in understanding the test easily. What do you think?
It("should error out when a component is not present or when a devfile flag is used", func() {
By("the component is not present")
args := []string{"exec", "--context", commonVar.Context}
args = append(args, []string{"--", "touch", "/projects/blah.js"}...)
helper.Cmd("odo", args...).ShouldFail()
By("the devfile flag is used")
args = []string{"exec", "--context", commonVar.Context, "--devfile", "invalid.yaml"}
args = append(args, []string{"--", "touch", "/projects/blah.js"}...)
helper.Cmd("odo", args...).ShouldFail()
})
args := []string{"create", "nodejs", cmpName, "--context", commonVar.Context} | ||
helper.Cmd("odo", args...).ShouldPass() |
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.
Is this a new pattern that you're thinking of implementing? If so, I would like here more on it. If not, I would prefer if we simply use helper.Cmd("odo", "create", "nodejs", cmpName, "--context", commonVar.Context).ShouldPass()
instead, I think it is more readable that way, or at least I have gotten used to reading it like that.
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.
No, I was keeping the previous syntax, but I will change with the syntax used anywhere else
Expect(output).To(ContainSubstring("no command was given")) | ||
}) | ||
|
||
It("should error out when a invalid command is given by the user", func() { |
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.
an invalid command*
SonarCloud Quality Gate failed. 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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dharmit 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 |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
9 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
What type of PR is this?
/kind tests
What does this PR do / why we need it:
Which issue(s) this PR fixes:
Partially Fixes #4741
PR acceptance criteria:
Unit test
Integration test
Documentation
I have read the test guidelines
How to test changes / Special notes to the reviewer: