Add test 'che-smoke-test' as PR checks
* Add 'smoke-test' to OpenShift CI * Add 'pod-che-smoke-test.yaml' component * Add 'startSmokeTest' to 'common.sh' * Update 'pod-oauth-factory-test.yaml' componentpull/651/head
parent
be4383abac
commit
9422bf86ac
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 Red Hat, Inc.
|
# Copyright (c) 2023-2024 Red Hat, Inc.
|
||||||
# This program and the accompanying materials are made
|
# This program and the accompanying materials are made
|
||||||
# available under the terms of the Eclipse Public License 2.0
|
# available under the terms of the Eclipse Public License 2.0
|
||||||
# which is available at https://www.eclipse.org/legal/epl-2.0/
|
# which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
|
@ -393,6 +393,38 @@ startOAuthFactoryTest() {
|
||||||
# wait for the pod to start
|
# wait for the pod to start
|
||||||
n=0
|
n=0
|
||||||
while [ $n -le 120 ]
|
while [ $n -le 120 ]
|
||||||
|
do
|
||||||
|
PHASE=$(oc get pod -n ${CHE_NAMESPACE} ${TEST_POD_NAME} \
|
||||||
|
--template='{{ .status.phase }}')
|
||||||
|
if [[ ${PHASE} == "Running" ]]; then
|
||||||
|
echo "[INFO] Factory test started successfully."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
n=$(( n+1 ))
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[ERROR] Failed to start Factory test."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
startSmokeTest() {
|
||||||
|
CHE_URL=https://$(oc get route -n ${CHE_NAMESPACE} che -o jsonpath='{.spec.host}')
|
||||||
|
# patch che-smoke-test.yaml
|
||||||
|
cat .ci/openshift-ci/pod-che-smoke-test.yaml > che-smoke-test.yaml
|
||||||
|
sed -i "s#CHE_URL#${CHE_URL}#g" che-smoke-test.yaml
|
||||||
|
sed -i "s#CHE-NAMESPACE#${CHE_NAMESPACE}#g" che-smoke-test.yaml
|
||||||
|
sed -i "s#OCP_USER_NAME#${OCP_NON_ADMIN_USER_NAME}#g" che-smoke-test.yaml
|
||||||
|
sed -i "s#OCP_USER_PASSWORD#${OCP_LOGIN_PASSWORD}#g" che-smoke-test.yaml
|
||||||
|
|
||||||
|
echo "[INFO] Applying the following patched Smoke Test Pod:"
|
||||||
|
cat che-smoke-test.yaml
|
||||||
|
echo "[INFO] --------------------------------------------------"
|
||||||
|
oc apply -f che-smoke-test.yaml
|
||||||
|
# wait for the pod to start
|
||||||
|
n=0
|
||||||
|
while [ $n -le 120 ]
|
||||||
do
|
do
|
||||||
PHASE=$(oc get pod -n ${CHE_NAMESPACE} ${TEST_POD_NAME} \
|
PHASE=$(oc get pod -n ${CHE_NAMESPACE} ${TEST_POD_NAME} \
|
||||||
--template='{{ .status.phase }}')
|
--template='{{ .status.phase }}')
|
||||||
|
|
@ -405,7 +437,7 @@ startOAuthFactoryTest() {
|
||||||
n=$(( n+1 ))
|
n=$(( n+1 ))
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "[ERROR] Failed to start smoke test."
|
echo "[ERROR] Failed to start Smoke test."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -434,8 +466,8 @@ collectEclipseCheLogs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
collectLogs() {
|
collectLogs() {
|
||||||
echo "[INFO] Waiting until oauth test pod finished"
|
echo "[INFO] Waiting until test pod finished"
|
||||||
oc logs -n ${CHE_NAMESPACE} ${TEST_POD_NAME} -c oauth-test -f
|
oc logs -n ${CHE_NAMESPACE} ${TEST_POD_NAME} -c test -f
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
# Download artifacts
|
# Download artifacts
|
||||||
|
|
@ -449,13 +481,16 @@ collectLogs() {
|
||||||
oc exec -n ${CHE_NAMESPACE} ${TEST_POD_NAME} -c download-reports -- touch /tmp/done
|
oc exec -n ${CHE_NAMESPACE} ${TEST_POD_NAME} -c download-reports -- touch /tmp/done
|
||||||
|
|
||||||
# Revoke and delete the OAuth application
|
# Revoke and delete the OAuth application
|
||||||
|
if [[ ${TEST_POD_NAME} == "oauth-factory-test" ]]; then
|
||||||
revokeAuthorizedOAuthApplication ${APPLICATION_ID} ${APPLICATION_SECRET}
|
revokeAuthorizedOAuthApplication ${APPLICATION_ID} ${APPLICATION_SECRET}
|
||||||
deleteOAuthApplicationGitLabServer ${OAUTH_ID} ${ADMIN_ACCESS_TOKEN}
|
deleteOAuthApplicationGitLabServer ${OAUTH_ID} ${ADMIN_ACCESS_TOKEN}
|
||||||
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
EXIT_CODE=$(oc logs -n ${CHE_NAMESPACE} ${TEST_POD_NAME} -c oauth-test | grep EXIT_CODE)
|
EXIT_CODE=$(oc logs -n ${CHE_NAMESPACE} ${TEST_POD_NAME} -c test | grep EXIT_CODE)
|
||||||
if [[ ${EXIT_CODE} != "+ EXIT_CODE=0" ]]; then
|
if [[ ${EXIT_CODE} != "+ EXIT_CODE=0" ]]; then
|
||||||
echo "[ERROR] Factory OAuth test failed. Job failed."
|
echo "[ERROR] GUI test failed. Job failed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "[INFO] Job completed successfully."
|
echo "[INFO] Job completed successfully."
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: che-smoke-test
|
||||||
|
namespace: CHE-NAMESPACE
|
||||||
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: test-run-results
|
||||||
|
- name: ffmpeg-video
|
||||||
|
- name: dshm
|
||||||
|
emptyDir:
|
||||||
|
medium: Memory
|
||||||
|
containers:
|
||||||
|
# container containing the tests
|
||||||
|
- name: test
|
||||||
|
image: quay.io/eclipse/che-e2e:next
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: VIDEO_RECORDING
|
||||||
|
value: "true"
|
||||||
|
- name: TEST_SUITE
|
||||||
|
value: "test"
|
||||||
|
- name: TS_SELENIUM_EDITOR
|
||||||
|
value: "che-code"
|
||||||
|
- name: USERSTORY
|
||||||
|
value: "SmokeTest"
|
||||||
|
- name: NODE_TLS_REJECT_UNAUTHORIZED
|
||||||
|
value: "0"
|
||||||
|
- name: TS_SELENIUM_BASE_URL
|
||||||
|
value: "CHE_URL"
|
||||||
|
- name: TS_SELENIUM_LOG_LEVEL
|
||||||
|
value: "TRACE"
|
||||||
|
- name: TS_SELENIUM_OCP_USERNAME
|
||||||
|
value: "OCP_USER_NAME"
|
||||||
|
- name: TS_SELENIUM_OCP_PASSWORD
|
||||||
|
value: "OCP_USER_PASSWORD"
|
||||||
|
- name: TS_SELENIUM_VALUE_OPENSHIFT_OAUTH
|
||||||
|
value: "true"
|
||||||
|
- name: TS_OCP_LOGIN_PAGE_PROVIDER_TITLE
|
||||||
|
value: "htpasswd"
|
||||||
|
- name: DELETE_WORKSPACE_ON_FAILED_TEST
|
||||||
|
value: "true"
|
||||||
|
- name: TS_SELENIUM_START_WORKSPACE_TIMEOUT
|
||||||
|
value: "360000"
|
||||||
|
- name: TS_IDE_LOAD_TIMEOUT
|
||||||
|
value: "40000"
|
||||||
|
volumeMounts:
|
||||||
|
- name: test-run-results
|
||||||
|
mountPath: /tmp/e2e/report/
|
||||||
|
- name: ffmpeg-video
|
||||||
|
mountPath: /tmp/ffmpeg_report/
|
||||||
|
- name: dshm
|
||||||
|
mountPath: /dev/shm
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "3Gi"
|
||||||
|
cpu: "2"
|
||||||
|
limits:
|
||||||
|
memory: "4Gi"
|
||||||
|
cpu: "2"
|
||||||
|
# Download results
|
||||||
|
- name: download-reports
|
||||||
|
image: eeacms/rsync
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
volumeMounts:
|
||||||
|
- name: test-run-results
|
||||||
|
mountPath: /tmp/e2e/report/
|
||||||
|
- name: ffmpeg-video
|
||||||
|
mountPath: /tmp/ffmpeg_report/
|
||||||
|
resources:
|
||||||
|
command: ["sh"]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"-c",
|
||||||
|
"while true; if [[ -f /tmp/done ]]; then exit 0; fi; do sleep 1; done",
|
||||||
|
]
|
||||||
|
restartPolicy: Never
|
||||||
|
|
@ -12,7 +12,7 @@ spec:
|
||||||
medium: Memory
|
medium: Memory
|
||||||
containers:
|
containers:
|
||||||
# container containing the tests
|
# container containing the tests
|
||||||
- name: oauth-test
|
- name: test
|
||||||
image: quay.io/eclipse/che-e2e:next
|
image: quay.io/eclipse/che-e2e:next
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024 Red Hat, Inc.
|
||||||
|
# This program and the accompanying materials are made
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# Red Hat, Inc. - initial API and implementation
|
||||||
|
#
|
||||||
|
|
||||||
|
# exit immediately when a command fails
|
||||||
|
set -ex
|
||||||
|
# only exit with zero if all commands of the pipeline exit successfully
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
export TEST_POD_NAME=${TEST_POD_NAME:-"che-smoke-test"}
|
||||||
|
|
||||||
|
# import common test functions
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
source "${SCRIPT_DIR}"/common.sh
|
||||||
|
|
||||||
|
trap "collectLogs" EXIT SIGINT
|
||||||
|
|
||||||
|
provisionOpenShiftOAuthUser
|
||||||
|
createCustomResourcesFile
|
||||||
|
deployChe
|
||||||
|
startSmokeTest
|
||||||
Loading…
Reference in New Issue