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

Add integration tests for devfile storage and exec #2838

Merged
merged 5 commits into from Apr 15, 2020

Conversation

maysunfaisal
Copy link
Contributor

@maysunfaisal maysunfaisal commented Apr 7, 2020

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

  • devfile exec
  • devfile storage

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

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation label Apr 7, 2020
@maysunfaisal maysunfaisal changed the title Add integration tests for devfile storage and exec {WIP} Add integration tests for devfile storage and exec Apr 7, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Apr 7, 2020
@maysunfaisal maysunfaisal changed the title {WIP} Add integration tests for devfile storage and exec Add integration tests for devfile storage and exec Apr 7, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. Required by Prow. label Apr 7, 2020
@maysunfaisal
Copy link
Contributor Author

/retest

1 similar comment
@maysunfaisal
Copy link
Contributor Author

/retest

@codecov
Copy link

codecov bot commented Apr 8, 2020

Codecov Report

Merging #2838 into master will decrease coverage by 0.08%.
The diff coverage is n/a.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
pkg/watch/watch.go 64.70% <0.00%> (-4.71%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11e04b6...8cddc4f. Read the comment docs.

Copy link
Member

@johnmcollier johnmcollier left a 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
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

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)
Copy link
Member

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)

Copy link
Contributor Author

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() {
Copy link
Member

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:

  1. 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)
  2. Exec into the runtime container and do a curl/wget there
  3. Handle later as part of the end-to-end tests

Copy link
Contributor Author

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?

Copy link
Member

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?

Copy link
Contributor Author

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"
Copy link
Member

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.

Copy link
Contributor Author

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"))
Copy link
Member

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.

@amitkrout
Copy link
Contributor

@maysunfaisal rebase please.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Apr 9, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Apr 9, 2020
@maysunfaisal
Copy link
Contributor Author

@johnmcollier @amitkrout branch has been rebased and updated with feedback

Copy link
Member

@johnmcollier johnmcollier left a 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

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 10, 2020
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 10, 2020
@amitkrout
Copy link
Contributor

now flag flake - #2642
/test v4.2-integration-e2e-benchmark

@maysunfaisal
Copy link
Contributor Author

@johnmcollier FYI I had to add another commit to fix another test that I missed, the travis and CI tests have passed now.

Copy link
Member

@johnmcollier johnmcollier left a 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

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 13, 2020
@kadel
Copy link
Member

kadel commented Apr 14, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Apr 14, 2020
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@maysunfaisal
Copy link
Contributor Author

maysunfaisal commented Apr 14, 2020

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>
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 15, 2020
Copy link
Member

@johnmcollier johnmcollier left a 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

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Apr 15, 2020
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

4 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 0da6ff4 into redhat-developer:master Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cover Devfile Exec and Storage Integration Tests
7 participants