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 integration tests for devfile storage and exec #2838
Add integration tests for devfile storage and exec #2838
Conversation
/retest |
1 similar comment
/retest |
Codecov Report
@@ Coverage Diff @@
## master #2838 +/- ##
==========================================
- Coverage 43.06% 42.97% -0.09%
==========================================
Files 97 97
Lines 8917 8917
==========================================
- Hits 3840 3832 -8
- Misses 4713 4718 +5
- Partials 364 367 +3
Continue to review full report at Codecov.
|
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.
Overall tests look good. Mostly minor comments and one question around testing that the app is running.
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 |
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.
Does the license for this need to be apache2 to match the rest of odo?
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.
Removed, git cloning it instead
@@ -0,0 +1,18 @@ | |||
Template from https://github.com/che-samples/web-nodejs-sample |
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.
Maybe rather than storing this in the odo repo we just do a git clone in our tests? I think some of the other odo integration tests clone repos
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.
git cloning it right now
helper.CmdShouldPass("odo", "preference", "set", "Experimental", "true") | ||
|
||
cmpName = helper.RandString(6) | ||
helper.CmdShouldPass("odo", "create", "nodejs", "--project", namespace, cmpName) |
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 have some concerns about always creating a nodejs component for all of the tests, and baking it into the test suite setup. Could we have some integration tests that do test devfiles from https://github.com/elsony/devfile-registry? (Such as the maven or springboot ones)
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 will put some springboot tests here and there since it has two component containers.
helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace) | ||
|
||
// use the force build flag and push | ||
output := helper.CmdShouldPass("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace, "-f") | ||
Expect(output).To(Not(ContainSubstring("No file changes detected, skipping build"))) | ||
}) | ||
|
||
It("should execute the default devbuild and devrun commands if present", 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.
Can some of these test cases test that the built/running application is actually running?
We might need to ask the odo folks (tag @amitkrout) if it's possible to get the ingress domain and pass it into odo url create
, if not we can do one of three things:
- Wait for
odo url create
to support creating routes for devfile components on OpenShift (so we don't have to pass in the ingress domain) - Exec into the runtime container and do a curl/wget there
- Handle later as part of the end-to-end tests
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.
Thinking aloud, how do we configure ingress host between running on CI and running on ppl's machines?
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.
@maysunfaisal It looks like #2833 is the issue we wanna keep an eye on. So maybe best to wait?
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.
yeah url endpoint testing can be done with that issue!
@@ -41,22 +45,21 @@ var _ = Describe("odo devfile url command tests", func() { | |||
Context("Listing urls", func() { | |||
It("should list url after push", func() { | |||
var stdout string | |||
componentName := helper.RandString(6) | |||
url1 := helper.RandString(5) | |||
host := helper.RandString(5) + ".com" |
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.
Not an issue with your tests, but I just realized we're using a random URL for the ingress host, which would cause issues if we wanted to test that the URL actually exposed the app
Nothing for you to do, but something we need to keep in mind.
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.
yep, we need to provide a correct host when we're testing the ingress domain
|
||
output := helper.CmdShouldFail("odo", "push", "--devfile", "devfile.yaml", "--namespace", namespace) | ||
Expect(output).NotTo(ContainSubstring("Executing devrun command")) | ||
Expect(output).To(ContainSubstring("Failed to start component with name")) |
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.
You can probably remove some of the output checks in the test cases you added, such as the middle one here.
I.e. it's probably sufficient to just check that Executing devrun command
doesn't exist and that The command \"devrun\" was not found in the devfile
was found.
@maysunfaisal rebase please. |
@johnmcollier @amitkrout branch has been rebased and updated with feedback |
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.
Changes look good and we're greatly increasing our test coverage, nice work. We'll use #2833 to cover testing the running app over ingress.
/lgtm
now flag flake - #2642 |
@johnmcollier FYI I had to add another commit to fix another test that I missed, the travis and CI tests have passed now. |
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.
/lgtm
Adding the label back as the tests were updated
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel 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 Please review the full test history for this PR and help us cut down flakes. |
wow merge conflict, lgtm will have to be added again :/ |
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
Signed-off-by: Maysun J Faisal <maysun.j.faisal@ibm.com>
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.
Adding back the label
/lgtm
/retest Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Signed-off-by: Maysun J Faisal maysun.j.faisal@ibm.com
What type of PR is this?
/kind feature
What does does this PR do / why we need it:
This PR adds integration tests for
since the original feature PRs for these user stories did not cover integration tests and had only the unit tests.
Which issue(s) this PR fixes:
Fixes #2818
How to test changes / Special notes to the reviewer:
make test-cmd-devfile-push
make test-cmd-devfile-url