From 0eb48584ef6ccaede8d64ff395236841df5a8d78 Mon Sep 17 00:00:00 2001 From: Aleksandr Shmaraiev Date: Thu, 20 Feb 2020 11:02:41 +0200 Subject: [PATCH] Add scripts to launch 'che-rc' jobs on the 'centos-ci' (#16039) --- .../centos-ci/functional_tests_utils.sh | 28 ++++++++++--- .../rc/cico-rc-multiuser-happy-path-test.sh | 28 +++++++++++++ .../rc/cico-rc-multiuser-integration-tests.sh | 39 +++++++++++++++++++ .../centos-ci/rc/cico-rc-ocp-oauth-test.sh | 38 ++++++++++++++++++ .../rc/cico-rc-rolling-strategy-test.sh | 38 ++++++++++++++++++ tests/.infra/centos-ci/rc/rc_function_util.sh | 23 +++++++++++ 6 files changed, 189 insertions(+), 5 deletions(-) create mode 100644 tests/.infra/centos-ci/rc/cico-rc-multiuser-happy-path-test.sh create mode 100644 tests/.infra/centos-ci/rc/cico-rc-multiuser-integration-tests.sh create mode 100755 tests/.infra/centos-ci/rc/cico-rc-ocp-oauth-test.sh create mode 100755 tests/.infra/centos-ci/rc/cico-rc-rolling-strategy-test.sh create mode 100755 tests/.infra/centos-ci/rc/rc_function_util.sh diff --git a/tests/.infra/centos-ci/functional_tests_utils.sh b/tests/.infra/centos-ci/functional_tests_utils.sh index 35869760b5..386372959a 100755 --- a/tests/.infra/centos-ci/functional_tests_utils.sh +++ b/tests/.infra/centos-ci/functional_tests_utils.sh @@ -310,8 +310,13 @@ CHE_ROUTE=$(oc get route che --template='{{ .spec.host }}') createTestWorkspaceAndRunTest() { defineCheRoute - ### Create workspace - chectl workspace:start --access-token "$USER_ACCESS_TOKEN" -f https://raw.githubusercontent.com/eclipse/che/master/tests/e2e/files/happy-path/happy-path-workspace.yaml + ### Create workspace + DEV_FILE_URL=$1 + if [[ ${DEV_FILE_URL} = "" ]]; then # by default it is used 'happy-path-devfile' yaml from CHE 'master' branch + chectl workspace:start --access-token "$USER_ACCESS_TOKEN" --devfile=https://raw.githubusercontent.com/eclipse/che/master/tests/e2e/files/happy-path/happy-path-workspace.yaml + else + chectl workspace:start --access-token "$USER_ACCESS_TOKEN" $1 # it can be directly indicated other URL to 'devfile' yaml + fi ### Create directory for report mkdir report @@ -323,7 +328,7 @@ createTestWorkspaceAndRunTest() { -e TS_SELENIUM_USERNAME="${TEST_USERNAME}" \ -e TS_SELENIUM_PASSWORD="${TEST_USERNAME}" \ -e TS_SELENIUM_LOAD_PAGE_TIMEOUT=420000 \ - quay.io/eclipse/che-e2e:nightly ||IS_TESTS_FAILED=true + quay.io/eclipse/che-e2e:nightly || IS_TESTS_FAILED=true } function createTestUserAndObtainUserToken() { @@ -372,7 +377,7 @@ function setupEnvs() { } function configureGithubTestUser() { - echo "Configure GitHub test users" + echo "======== Configure GitHub test users ========" cd /root/payload mkdir -p che_local_conf_dir export CHE_LOCAL_CONF_DIR=/root/payload/che_local_conf_dir/ @@ -390,7 +395,7 @@ function installDockerCompose() { } function seleniumTestsSetup() { - echo "Start selenium tests" + echo "======== Start selenium tests ========" cd /root/payload export CHE_INFRASTRUCTURE=openshift defineCheRoute @@ -430,3 +435,16 @@ function runDevfileTestSuite() { -e TS_SELENIUM_WORKSPACE_STATUS_POLLING=20000 \ quay.io/eclipse/che-e2e:nightly || IS_TESTS_FAILED=true } + +function getReleaseVersion() { + echo $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d'-' -f1) #cut SNAPSHOT from the version name +} + +function setupReleaseVersionAndTag() { + echo "======== Starting Che RC test job $(date) ========" + RELEASE_VERSION=$(getReleaseVersion) + RELEASE_TAG="rc" + + echo "======== Release version:" ${RELEASE_VERSION} + echo "======== Release tag:" ${RELEASE_TAG} +} diff --git a/tests/.infra/centos-ci/rc/cico-rc-multiuser-happy-path-test.sh b/tests/.infra/centos-ci/rc/cico-rc-multiuser-happy-path-test.sh new file mode 100644 index 0000000000..e647f1a11b --- /dev/null +++ b/tests/.infra/centos-ci/rc/cico-rc-multiuser-happy-path-test.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Copyright (c) 2020 Red Hat, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +set -e +set +x + +source tests/.infra/centos-ci/functional_tests_utils.sh +source tests/.infra/centos-ci/rc/rc_function_util.sh + + # It needs to implement the patch of 'devfile' yaml to appropriate release tags images + +setupEnvs +installKVM +installDependencies +setupReleaseVersionAndTag +installAndStartMinishift +loginToOpenshiftAndSetDevRole +prepareCustomResourceFile false +installCheCtl +deployCheIntoCluster --che-operator-cr-yaml=/tmp/custom-resource.yaml +createTestUserAndObtainUserToken +createTestWorkspaceAndRunTest --devfile=https://raw.githubusercontent.com/eclipse/che/cico-rc-test/tests/e2e/files/happy-path/happy-path-workspace.yaml +getOpenshiftLogs +archiveArtifacts "rc-multiuser-happy-path-test" +if [[ "$IS_TESTS_FAILED" == "true" ]]; then exit 1; fi \ No newline at end of file diff --git a/tests/.infra/centos-ci/rc/cico-rc-multiuser-integration-tests.sh b/tests/.infra/centos-ci/rc/cico-rc-multiuser-integration-tests.sh new file mode 100644 index 0000000000..b9a5ee74af --- /dev/null +++ b/tests/.infra/centos-ci/rc/cico-rc-multiuser-integration-tests.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Copyright (c) 2020 Red Hat, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +set -e +set +x + +source tests/.infra/centos-ci/functional_tests_utils.sh +source tests/.infra/centos-ci/rc/rc_function_util.sh + +setupEnvs +installDependencies +setupReleaseVersionAndTag +installDockerCompose +installKVM +installAndStartMinishift +loginToOpenshiftAndSetDevRole +prepareCustomResourceFile false +installCheCtl +deployCheIntoCluster --chenamespace=eclipse-che --che-operator-cr-yaml=/tmp/custom-resource.yaml +createIndentityProvider +seleniumTestsSetup + +bash /root/payload/tests/legacy-e2e/che-selenium-test/selenium-tests.sh \ + --threads=3 \ + --host=${CHE_ROUTE} \ + --port=80 \ + --multiuser \ + --fail-script-on-failed-tests \ + || IS_TESTS_FAILED=true + + +echo "=========================== THIS IS POST TEST ACTIONS ==============================" +saveSeleniumTestResult +getOpenshiftLogs +archiveArtifacts "rc-multiuser-integration-tests" +if [[ "$IS_TESTS_FAILED" == "true" ]]; then exit 1; fi diff --git a/tests/.infra/centos-ci/rc/cico-rc-ocp-oauth-test.sh b/tests/.infra/centos-ci/rc/cico-rc-ocp-oauth-test.sh new file mode 100755 index 0000000000..b18b626f00 --- /dev/null +++ b/tests/.infra/centos-ci/rc/cico-rc-ocp-oauth-test.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Copyright (c) 2020 Red Hat, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +set -e +set +x + +source tests/.infra/centos-ci/functional_tests_utils.sh +source tests/.infra/centos-ci/rc/rc_function_util.sh + +setupEnvs +installDependencies +setupReleaseVersionAndTag +installDockerCompose +installKVM +installAndStartMinishift +loginToOpenshiftAndSetDevRole +prepareCustomResourceFile true +installCheCtl +deployCheIntoCluster --chenamespace=eclipse-che --che-operator-cr-yaml=/tmp/custom-resource.yaml +seleniumTestsSetup + +bash tests/legacy-e2e/che-selenium-test/selenium-tests.sh \ + --threads=1 \ + --host=${CHE_ROUTE} \ + --port=80 \ + --multiuser \ + --test=org.eclipse.che.selenium.site.ocpoauth.** \ + --fail-script-on-failed-tests \ + || IS_TESTS_FAILED=true + +echo "=========================== THIS IS POST TEST ACTIONS ==============================" +saveSeleniumTestResult +getOpenshiftLogs +archiveArtifacts "rc-ocp-oauth-test" +if [[ "$IS_TESTS_FAILED" == "true" ]]; then exit 1; fi diff --git a/tests/.infra/centos-ci/rc/cico-rc-rolling-strategy-test.sh b/tests/.infra/centos-ci/rc/cico-rc-rolling-strategy-test.sh new file mode 100755 index 0000000000..bbbec0545a --- /dev/null +++ b/tests/.infra/centos-ci/rc/cico-rc-rolling-strategy-test.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# Copyright (c) 2020 Red Hat, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +set -e +set +x + +source tests/.infra/centos-ci/functional_tests_utils.sh +source tests/.infra/centos-ci/rc/rc_function_util.sh + +setupEnvs +installDependencies +setupReleaseVersionAndTag +installDockerCompose +installKVM +installAndStartMinishift +loginToOpenshiftAndSetDevRole +prepareCustomResourceFile false +installCheCtl +deployCheIntoCluster --chenamespace=eclipse-che --che-operator-cr-yaml=/tmp/custom-resource.yaml +seleniumTestsSetup + +bash tests/legacy-e2e/che-selenium-test/selenium-tests.sh \ + --threads=1 \ + --host=${CHE_ROUTE} \ + --port=80 \ + --multiuser \ + --test=org.eclipse.che.selenium.hotupdate.rolling.** \ + --fail-script-on-failed-tests \ + || IS_TESTS_FAILED=true + +echo "=========================== THIS IS POST TEST ACTIONS ==============================" +saveSeleniumTestResult +getOpenshiftLogs +archiveArtifacts "rc-rolling-strategy-test" +if [[ "$IS_TESTS_FAILED" == "true" ]]; then exit 1; fi diff --git a/tests/.infra/centos-ci/rc/rc_function_util.sh b/tests/.infra/centos-ci/rc/rc_function_util.sh new file mode 100755 index 0000000000..63df0cc679 --- /dev/null +++ b/tests/.infra/centos-ci/rc/rc_function_util.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Copyright (c) 2020 Red Hat, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html + +function prepareCustomResourceFile() { + echo "======== Patch custom-resource.yaml ========" + cd /tmp + wget https://raw.githubusercontent.com/eclipse/che-operator/master/deploy/crds/org_v1_che_cr.yaml -O custom-resource.yaml + setOpenShiftoAuth=$1 # sets the value of 'openShiftoAuth' parameter + sed -i "s@openShiftoAuth: false@openShiftoAuth: $1@g" /tmp/custom-resource.yaml + sed -i "s@server:@server:\n customCheProperties:\n CHE_LIMITS_USER_WORKSPACES_RUN_COUNT: '-1'@g" /tmp/custom-resource.yaml + sed -i "s/customCheProperties:/customCheProperties:\n CHE_WORKSPACE_AGENT_DEV_INACTIVE__STOP__TIMEOUT__MS: '300000'/" /tmp/custom-resource.yaml + sed -i "s@identityProviderImage: 'quay.io/eclipse/che-keycloak:nightly'@identityProviderImage: 'quay.io/eclipse/che-keycloak:$RELEASE_TAG'@g" /tmp/custom-resource.yaml + sed -i "s@cheImage: ''@cheImage: 'quay.io/eclipse/che-server'@g" /tmp/custom-resource.yaml + sed -i "s@cheImageTag: 'nightly'@cheImageTag: '$RELEASE_TAG'@g" /tmp/custom-resource.yaml + sed -i "s@devfileRegistryImage: 'quay.io/eclipse/che-devfile-registry:nightly'@devfileRegistryImage: 'quay.io/eclipse/che-devfile-registry:$RELEASE_VERSION'@g" /tmp/custom-resource.yaml + sed -i "s@pluginRegistryImage: 'quay.io/eclipse/che-plugin-registry:nightly'@pluginRegistryImage: 'quay.io/eclipse/che-plugin-registry:$RELEASE_VERSION'@g " /tmp/custom-resource.yaml + cat /tmp/custom-resource.yaml +}