crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.26k stars 242 forks source link

test (e2e) : Add E2E test for java app deploy workflow using Eclipse JKube (#4397) #4414

Closed rohanKanojia closed 1 week ago

rohanKanojia commented 4 weeks ago

Description

Fix #4397

Signed-off-by: Rohan Kumar rohaan@redhat.com

Type of change

Checklist

Fixes: Issue #4397

Relates to: Issue #4397, Issue https://github.com/eclipse-jkube/team/issues/32

Solution/Idea

I added an E2E test that would clone the Eclipse JKube repository and deploy one of the quickstart jkube@quickstarts/maven/quarkus onto the deployed CRC cluster. I've used a simple Quarkus REST application, but it can be changed to something else as well.

Proposed changes

Add a new E2E test that would verify deployment workflow of a simple Java application using Eclipse JKube

Testing

This PR only adds an E2E test, in order to run it. Use the following command:

# Modify BUNDLE_LOCATION, PULL_SECRET_PATH and CRC_BINARY variables as per your environment
make e2e GODOG_OPTS="--godog.tags='@story_application_deployment'" BUNDLE_LOCATION="--bundle-location=xxxx" PULL_SECRET_PATH="--pull-secret-path=xxxx" CRC_BINARY="--crc-binary=xxxx"
Running e2e test in: /home/rokumar/go/src/github.com/crc-org/crc/test/e2e/out/test-run
Working directory set to: /home/rokumar/go/src/github.com/crc-org/crc/test/e2e/out/test-run
Expecting the bundle provided by the user
Using existing bundle: /home/rokumar/.crc/cache/crc_libvirt_4.17.0_amd64.crcbundle
Feature: Application Deployment Test
  User deploys a basic java application onto CRC cluster and expects that it's
  deployed successfully and is accessible via route

  Background:
    Given ensuring CRC cluster is running                                                                                                                             # testsuite.go:792 -> github.com/crc-org/crc/v2/test/e2e/testsuite.EnsureCRCIsRunning
    And ensuring oc command is available                                                                                                                              # testsuite.go:875 -> github.com/crc-org/crc/v2/test/e2e/testsuite.EnsureOCCommandIsAvailable
    And ensuring user is logged in succeeds                                                                                                                           # testsuite.go:842 -> github.com/crc-org/crc/v2/test/e2e/testsuite.EnsureUserIsLoggedIntoClusterSucceedsOrFails

  Scenario: Deploy a java application using Eclipse JKube in pod and then verify it's health                                                                          # features/application_deployment.feature:13
    When executing "oc new-project jkube-quarkus-app-deploy-flow-test" succeeds                                                                                       # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    And executing "oc create -f ../../../testdata/jkube-kubernetes-build-resources.yaml" succeeds                                                                     # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    And executing "oc start-build jkube-application-deploy-buildconfig --follow" succeeds                                                                             # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    And executing "oc rollout status -w dc/jkube-application-deploy-test --timeout=600s" succeeds                                                                     # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "successfully rolled out"                                                                                                              # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And executing "oc logs -lapp=jkube-application-deploy-test -f" succeeds                                                                                           # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    And executing "oc rollout status -w dc/quarkus --namespace jkube-quarkus-app-deploy-flow-test --timeout=600s" succeeds                                            # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "successfully rolled out"                                                                                                              # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And executing "oc get build -lapp=quarkus --namespace jkube-quarkus-app-deploy-flow-test" succeeds                                                                # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "quarkus-s2i"                                                                                                                          # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And executing "oc get buildconfig -lapp=quarkus --namespace jkube-quarkus-app-deploy-flow-test" succeeds                                                          # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "quarkus-s2i"                                                                                                                          # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And executing "oc get imagestream -lapp=quarkus --namespace jkube-quarkus-app-deploy-flow-test" succeeds                                                          # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "quarkus"                                                                                                                              # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And executing "oc get pods -lapp=quarkus --namespace jkube-quarkus-app-deploy-flow-test" succeeds                                                                 # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "quarkus"                                                                                                                              # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And stdout should contain "1/1     Running"                                                                                                                       # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And executing "oc get svc -lapp=quarkus --namespace jkube-quarkus-app-deploy-flow-test" succeeds                                                                  # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "quarkus"                                                                                                                              # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And executing "oc get routes -lapp=quarkus --namespace jkube-quarkus-app-deploy-flow-test" succeeds                                                               # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    Then stdout should contain "quarkus"                                                                                                                              # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    And with up to "4" retries with wait period of "1m" http response from "http://quarkus-jkube-quarkus-app-deploy-flow-test.apps-crc.testing" has status code "200" # testsuite.go:560 -> github.com/crc-org/crc/v2/test/e2e/testsuite.CheckHTTPResponseWithRetry
    Then executing "curl -s http://quarkus-jkube-quarkus-app-deploy-flow-test.apps-crc.testing" succeeds                                                              # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
    And stdout should contain "{"applicationName":"JKube","message":"Subatomic JKube really whips the llama's ass!"}"                                                 # shell.go:301 -> github.com/crc-org/crc/v2/test/extended/util.CommandReturnShouldContain
    When executing "oc delete project jkube-quarkus-app-deploy-flow-test" succeeds                                                                                    # shell.go:245 -> github.com/crc-org/crc/v2/test/extended/util.ExecuteCommandSucceedsOrFails
Deleted CRC instance (if one existed).

1 scenarios (1 passed)
28 steps (28 passed)
33m33.762301105s
ok      github.com/crc-org/crc/v2/test/e2e      2013.779s
openshift-ci[bot] commented 4 weeks ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign cfergeau for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[test/OWNERS](https://github.com/crc-org/crc/blob/main/test/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
openshift-ci[bot] commented 4 weeks ago

Hi @rohanKanojia. Thanks for your PR.

I'm waiting for a crc-org member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
praveenkumar commented 4 weeks ago

/ok-to-test

praveenkumar commented 2 weeks ago

/ok-to-test

praveenkumar commented 1 week ago

@rohanKanojia check the e2e failure, looks like it is failing with basic test because status of crc is running which is not expected.

rohanKanojia commented 1 week ago

@praveenkumar : I tried reproducing it locally but couldn't reproduce it. Could it be a flaky failure?

rohanKanojia commented 1 week ago

@praveenkumar : I have added @cleanup annotation that shall perform additional cleanup after test execution.

Now the only failing e2e test I see is of cert rotation:

  Scenario: Start CRC "in the future" and clean up # test/e2e/features/cert_rotation.feature:9
    When starting CRC with default bundle along with stopped network time synchronization succeeds # test/e2e/features/cert_rotation.feature:11
      Error: command 'CRC_DISABLE_UPDATE_CHECK=true CRC_DEBUG_ENABLE_STOP_NTP=true crc start -p '/home/packer/pull-secret' -b /home/packer/crc_libvirt_4.17.1_amd64.crcbundle', expected to succeed, exited with exit code: 1

I think it was failing before too.

praveenkumar commented 1 week ago

@rohanKanojia squash the commits because second commit is making changes what you did in first one. other than that looks good to me.

openshift-ci[bot] commented 1 week ago

@rohanKanojia: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/integration-crc 8e6e2f63463b6f7a22331f0a811ad3e1db4a9d3f link true /test integration-crc
ci/prow/e2e-crc 8e6e2f63463b6f7a22331f0a811ad3e1db4a9d3f link true /test e2e-crc

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).