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

CRW-3566: Empty workspace project export API test: added CloneGitRepoAPI.spec.ts, OpenshiftHelper #22129

Merged
merged 3 commits into from
Apr 12, 2023

Conversation

nallikaea
Copy link
Contributor

@nallikaea nallikaea commented Apr 4, 2023

What does this PR do?

Screenshot/screencast of this PR

N/A

What issues does this PR fix or reference?

CRW-3566

How to test this PR?

export USERSTORY=CloneGitRepoAPI && npm run test-api

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

@nallikaea
Copy link
Contributor Author

nallikaea commented Apr 4, 2023

/usr/bin/npm run test-api

> @eclipse-che/che-e2e@7.64.0-SNAPSHOT test-api
> export TS_USE_WEB_DRIVER_FOR_TEST=false && npm run test


> @eclipse-che/che-e2e@7.64.0-SNAPSHOT test
> ./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export USERSTORY=$USERSTORY && mocha --config dist/configs/mocharc.js

Initialized default values

TS_SELENIUM_VALUE_TLS_SUPPORT =       
TS_SELENIUM_VALUE_OPENSHIFT_OAUTH =   true
TS_OCP_LOGIN_PAGE_PROVIDER_TITLE =    htpasswd
E2E_OCP_CLUSTER_VERSION =             4.x
TS_SELENIUM_LOG_LEVEL =               TRACE
TS_SELENIUM_OCP_USERNAME =            admin
TS_SELENIUM_W3C_CHROME_OPTION =       true
NODE_TLS_REJECT_UNAUTHORIZED =        0
TS_SELENIUM_EDITOR =                  che-code

> @eclipse-che/che-e2e@7.64.0-SNAPSHOT tsc
> rm -rf ./dist && ./configs/sh-scripts/generateIndex.sh && tsc -p .

Generating index.ts file...
Warning: Cannot find any files matching pattern "dist/specs/CloneGitRepoAPI.spec.js"

################## Launch Information ##################

      TS_SELENIUM_BASE_URL: https://devspaces.apps.ocp410-mdolhal.crw-qe.com
      TS_SELENIUM_HEADLESS: false
      TS_SELENIUM_OCP_USERNAME: admin
      TS_SELENIUM_EDITOR:   che-code

      TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: petclinic-dev-environment
      TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: 1000
      TS_SELENIUM_REPORT_FOLDER: ./report
      TS_SELENIUM_EXECUTION_SCREENCAST: false
      DELETE_SCREENCAST_IF_TEST_PASS: true
      TS_SELENIUM_REMOTE_DRIVER_URL: 
      DELETE_WORKSPACE_ON_FAILED_TEST: false
      TS_SELENIUM_LOG_LEVEL: TRACE
      TS_SELENIUM_LAUNCH_FULLSCREEN: true

      MOCHA_DRIRECTORY is not set
      USERSTORY: CloneGitRepoAPI

      to output timeout variables, set TS_SELENIUM_PRINT_TIMEOUT_VARIABLES to true
 ######################################################## 


            ‣ DriverHelper.getDriver
  Empty Workspace export repository tests
          ▼ OpenshiftHelper.loginToOcp: Login to the 'OC' client
          ▼ OpenshiftHelper.getServerUrl: Get server api url.
▼ https://api.ocp410-mdolhal.crw-qe.com:6443
Login successful.

You have access to 70 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "project".
          ▼ OpenshiftHelper.apply:
cat <<EOF | oc apply -n admin-devspaces -f - 
apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspace
metadata:
  name: empty-161
spec:
  started: true
  template:
    components:
      - container:
          image: quay.io/devfile/universal-developer-image:latest
        name: universal-developer-image
  contributions:
    - name: che-code
      uri: https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml
      components:
        - name: che-code-runtime-description
          container:
            env:
              - name: CODE_HOST
                value: 0.0.0.0
EOF
devworkspace.workspace.devfile.io/empty-161 created
          ▼ OpenshiftHelper.wait: Wait till workspace ready.
oc wait -n admin-devspaces --for=condition=Ready dw empty-161 --timeout=360s
devworkspace.workspace.devfile.io/empty-161 condition met
          ▼ OpenshiftHelper.getWorkspacePodName: Get workspace pod name.
oc get pod -l controller.devfile.io/devworkspace_name=empty-161 -n admin-devspaces -o name
pod/workspace8d4ee3f76c3949e4-6d695b7555-sg57l
          ▼ OpenshiftHelper.getContainerName: Get container name.
oc get pod/workspace8d4ee3f76c3949e4-6d695b7555-sg57l -o jsonpath='{.spec.containers[*].name}' -n admin-devspaces
universal-developer-image

    Clone public repo without previous set ups
          ▼ OpenshiftHelper.executeCommand
oc exec -i pod/workspace8d4ee3f76c3949e4-6d695b7555-sg57l -n admin-devspaces -c universal-developer-image -- sh -c "pwd"
/projects
          ▼ OpenshiftHelper.executeCommand
oc exec -i pod/workspace8d4ee3f76c3949e4-6d695b7555-sg57l -n admin-devspaces -c universal-developer-image -- sh -c "git clone https://github.com/crw-qe/web-nodejs-sample"
Cloning into 'web-nodejs-sample'...
      ✔ Check if public repo can be cloned (4887ms)
          ▼ OpenshiftHelper.executeCommand
oc exec -i pod/workspace8d4ee3f76c3949e4-6d695b7555-sg57l -n admin-devspaces -c universal-developer-image -- sh -c "ls "
web-nodejs-sample
      ✔ Check if project was created (2383ms)
          ▼ OpenshiftHelper.executeCommand
oc exec -i pod/workspace8d4ee3f76c3949e4-6d695b7555-sg57l -n admin-devspaces -c universal-developer-image -- sh -c "ls /projects/web-nodejs-sample"
LICENSE
README.md
app
devfile.yaml
package-lock.json
package.json
      ✔ Check if files were imported  (2382ms)
          ▼ OpenshiftHelper.executeCommand
oc exec -i pod/workspace8d4ee3f76c3949e4-6d695b7555-sg57l -n admin-devspaces -c universal-developer-image -- sh -c "rm -rf web-nodejs-sample"
          ▼ OpenshiftHelper.deleteWorkspace: Delete 'empty-161' workspace
oc patch dw empty-161 -n admin-devspaces -p '{ "metadata": { "finalizers": null }}' --type merge || true
devworkspace.workspace.devfile.io/empty-161 patched
oc delete dw empty-161 -n admin-devspaces || true
devworkspace.workspace.devfile.io "empty-161" deleted


  3 passing (55s)

            ‣ DriverHelper.wait (5000 milliseconds)

Process finished with exit code 0

@che-bot che-bot added target/branch Indicates that a PR will be merged into a branch other than master. status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. labels Apr 4, 2023
@nallikaea nallikaea changed the title WIP: Crw 3566 CRW-3566 Empty workspace project export API test: added CloneGitRepoAPI.spec.ts, ClusterUtils Apr 5, 2023
@nallikaea nallikaea changed the title CRW-3566 Empty workspace project export API test: added CloneGitRepoAPI.spec.ts, ClusterUtils CRW-3566: Empty workspace project export API test: added CloneGitRepoAPI.spec.ts, ClusterUtils Apr 5, 2023
@nallikaea nallikaea changed the title CRW-3566: Empty workspace project export API test: added CloneGitRepoAPI.spec.ts, ClusterUtils CRW-3566: Empty workspace project export API test: added CloneGitRepoAPI.spec.ts, OpenshiftHelper Apr 5, 2023
Copy link
Member

@ScrewTSW ScrewTSW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work Maryna!

tests/e2e/package.json Outdated Show resolved Hide resolved
@nallikaea nallikaea force-pushed the CRW-3566 branch 2 times, most recently from 8bca93b to 72897d6 Compare April 11, 2023 16:48
@nallikaea
Copy link
Contributor Author

Log after fix ups. @dmytro-ndp @ScrewTSW what do you think about it?

/usr/bin/npm run driver-less-test

> @eclipse-che/che-e2e@7.64.0-SNAPSHOT driver-less-test
> export TS_USE_WEB_DRIVER_FOR_TEST=false && npm run test


> @eclipse-che/che-e2e@7.64.0-SNAPSHOT test
> ./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export USERSTORY=$USERSTORY && mocha --config dist/configs/mocharc.js

Initialized default values

TS_SELENIUM_VALUE_TLS_SUPPORT =       
TS_SELENIUM_VALUE_OPENSHIFT_OAUTH =   true
TS_OCP_LOGIN_PAGE_PROVIDER_TITLE =    htpasswd
E2E_OCP_CLUSTER_VERSION =             4.x
TS_SELENIUM_LOG_LEVEL =               TRACE
TS_SELENIUM_OCP_USERNAME =            admin
TS_SELENIUM_W3C_CHROME_OPTION =       true
NODE_TLS_REJECT_UNAUTHORIZED =        0
TS_SELENIUM_EDITOR =                  che-code

> @eclipse-che/che-e2e@7.64.0-SNAPSHOT tsc
> rm -rf ./dist && ./configs/sh-scripts/generateIndex.sh && tsc -p .

Generating index.ts file...
Warning: Cannot find any files matching pattern "dist/specs/CloneGitRepoAPI.spec.js"

################## Launch Information ##################

      TS_SELENIUM_BASE_URL: https://devspaces.apps.ocp410-mdolhal.crw-qe.com
      TS_SELENIUM_HEADLESS: false
      TS_SELENIUM_OCP_USERNAME: admin
      TS_SELENIUM_EDITOR:   che-code

      TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: petclinic-dev-environment
      TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: 1000
      TS_SELENIUM_REPORT_FOLDER: ./report
      TS_SELENIUM_EXECUTION_SCREENCAST: false
      DELETE_SCREENCAST_IF_TEST_PASS: true
      TS_SELENIUM_REMOTE_DRIVER_URL: 
      DELETE_WORKSPACE_ON_FAILED_TEST: false
      TS_SELENIUM_LOG_LEVEL: TRACE
      TS_SELENIUM_LAUNCH_FULLSCREEN: true

      MOCHA_DRIRECTORY is not set
      USERSTORY: CloneGitRepoAPI

      to output timeout variables, set TS_SELENIUM_PRINT_TIMEOUT_VARIABLES to true
 ######################################################## 


            ‣ DriverHelper.getDriver
  Test cloning of repo "https://github.com/crw-qe/web-nodejs-sample" into empty workspace.
          ▼ OpenshiftClientExecutor.loginToOcp: Login to the 'OC' client
          ▼ OpenshiftClientExecutor.getServerUrl: Get server api url.
▼ https://api.ocp410-mdolhal.crw-qe.com:6443
Login successful.

You have access to 70 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "project".
          ▼ OpenshiftClientExecutor.apply:
cat <<EOF | oc apply -n admin-devspaces -f - 
apiVersion: workspace.devfile.io/v1alpha2
kind: DevWorkspace
metadata:
  name: empty-463
spec:
  started: true
  template:
    components:
      - container:
          image: quay.io/devfile/universal-developer-image:latest
        name: universal-developer-image
  contributions:
    - name: che-code
      uri: https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml
      components:
        - name: che-code-runtime-description
          container:
            env:
              - name: CODE_HOST
                value: 0.0.0.0
EOF
devworkspace.workspace.devfile.io/empty-463 created
          ▼ OpenshiftClientExecutor.wait: Wait till workspace ready.
oc wait -n admin-devspaces --for=condition=Ready dw empty-463 --timeout=360s
devworkspace.workspace.devfile.io/empty-463 condition met
          ▼ OpenshiftClientExecutor.getWorkspacePodName: Get workspace pod name.
oc get pod -l controller.devfile.io/devworkspace_name=empty-463 -n admin-devspaces -o name
pod/workspacede82f4c2862f4ae1-5bf7f56b59-tsbcp
          ▼ OpenshiftClientExecutor.getContainerName: Get container name.
oc get pod/workspacede82f4c2862f4ae1-5bf7f56b59-tsbcp -o jsonpath='{.spec.containers[*].name}' -n admin-devspaces
universal-developer-image

    Clone public repo without previous set ups
          ▼ OpenshiftClientExecutor.executeCommand
oc exec -i pod/workspacede82f4c2862f4ae1-5bf7f56b59-tsbcp -n admin-devspaces -c universal-developer-image -- sh -c "pwd"
/projects
          ▼ OpenshiftClientExecutor.executeCommand
oc exec -i pod/workspacede82f4c2862f4ae1-5bf7f56b59-tsbcp -n admin-devspaces -c universal-developer-image -- sh -c "git clone https://github.com/crw-qe/web-nodejs-sample"
Cloning into 'web-nodejs-sample'...
      ✔ Check if public repo can be cloned (5132ms)
          ▼ OpenshiftClientExecutor.executeCommand
oc exec -i pod/workspacede82f4c2862f4ae1-5bf7f56b59-tsbcp -n admin-devspaces -c universal-developer-image -- sh -c "ls "
web-nodejs-sample
      ✔ Check if project was created (2263ms)
          ▼ OpenshiftClientExecutor.executeCommand
oc exec -i pod/workspacede82f4c2862f4ae1-5bf7f56b59-tsbcp -n admin-devspaces -c universal-developer-image -- sh -c "ls /projects/web-nodejs-sample"
LICENSE
README.md
app
devfile.yaml
package-lock.json
package.json
      ✔ Check if files were imported  (32873ms)
          ▼ OpenshiftClientExecutor.executeCommand
oc exec -i pod/workspacede82f4c2862f4ae1-5bf7f56b59-tsbcp -n admin-devspaces -c universal-developer-image -- sh -c "rm -rf web-nodejs-sample"
          ▼ OpenshiftClientExecutor.deleteWorkspace: Delete 'empty-463' workspace
oc patch dw empty-463 -n admin-devspaces -p '{ "metadata": { "finalizers": null }}' --type merge || true
devworkspace.workspace.devfile.io/empty-463 patched
oc delete dw empty-463 -n admin-devspaces || true
devworkspace.workspace.devfile.io "empty-463" deleted


  3 passing (2m)

            ‣ DriverHelper.wait (5000 milliseconds)

Process finished with exit code 0

Copy link
Member

@ScrewTSW ScrewTSW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! LGTM

tests/e2e/README.md Outdated Show resolved Hide resolved
Maryna Dolhalova added 3 commits April 12, 2023 14:54
Signed-off-by: mdolhalo <mdolhalo@redhat.com>
Signed-off-by: mdolhalo <mdolhalo@redhat.com>
Signed-off-by: mdolhalo <mdolhalo@redhat.com>
Copy link
Contributor

@dmytro-ndp dmytro-ndp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge.

@dmytro-ndp dmytro-ndp merged commit 6e179e6 into eclipse-che:main Apr 12, 2023
@che-bot che-bot removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Apr 12, 2023
@nallikaea nallikaea deleted the CRW-3566 branch April 13, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/branch Indicates that a PR will be merged into a branch other than master.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants