diff --git a/dockerfiles/e2e/entrypoint.sh b/dockerfiles/e2e/entrypoint.sh index 44570efbb9a..f3d76986ce0 100755 --- a/dockerfiles/e2e/entrypoint.sh +++ b/dockerfiles/e2e/entrypoint.sh @@ -71,7 +71,7 @@ else fi # Launch tests -if [ $TEST_SUITE == "load-test" ]; then +if [ $TS_LOAD_TESTS ]; then timestamp=$(date +%s) user_folder="$TS_SELENIUM_USERNAME-$timestamp" export TS_SELENIUM_REPORT_FOLDER="./$user_folder/report" diff --git a/tests/e2e/TestConstants.ts b/tests/e2e/TestConstants.ts index 14c76fbf48b..68f43579ec1 100644 --- a/tests/e2e/TestConstants.ts +++ b/tests/e2e/TestConstants.ts @@ -228,6 +228,11 @@ export const TestConstants = { /** * URL of the workspace created by devworkspace-controller */ - TS_SELENIUM_DEVWORKSPACE_URL: process.env.TS_SELENIUM_DEVWORKSPACE_URL + TS_SELENIUM_DEVWORKSPACE_URL: process.env.TS_SELENIUM_DEVWORKSPACE_URL, + + /** + * This variable specifies that run test is used for load testing and that all artifacts will be sent to ftp client. + */ + TS_LOAD_TESTS: process.env.TS_LOAD_TESTS || 'false' }; diff --git a/tests/e2e/driver/CheReporter.ts b/tests/e2e/driver/CheReporter.ts index aaa80594e95..ba555ff99f4 100644 --- a/tests/e2e/driver/CheReporter.ts +++ b/tests/e2e/driver/CheReporter.ts @@ -95,7 +95,7 @@ class CheReporter extends mocha.reporters.Spec { }); runner.on('pass', async (test: mocha.Test) => { - if (TestConstants.TEST_SUITE === 'load-test') { + if (TestConstants.TS_LOAD_TESTS) { const loadTestReportFolder: string = TestConstants.TS_SELENIUM_LOAD_TEST_REPORT_FOLDER; const loadTestFilePath: string = loadTestReportFolder + '/load-test-results.txt'; const report = test.title + ': ' + test.duration + '\r'; diff --git a/tests/performance/load-tests.sh b/tests/performance/load-tests.sh index 4fa191f5f2d..a41e507bebe 100755 --- a/tests/performance/load-tests.sh +++ b/tests/performance/load-tests.sh @@ -6,6 +6,7 @@ TIMESTAMP=$(date +%s) TEST_FOLDER=$(pwd) LOG_LEVEL="INFO" SERVER_SETTING="oauth" +TEST_SUITE="load-test" function printHelp { YELLOW="\\033[93;1m" @@ -26,7 +27,8 @@ function printHelp { echo -e "-t count on how many times one user should run a workspace" echo -e "-l log level for test [ 'INFO' (default), 'DEBUG', 'TRACE' ]" echo -e "-s setting of CRW [ 'oauth' (default), 'no-oauth'] " - echo -e "-v cluster URL to obtain OC user token"${NC} + echo -e "-v cluster URL to obtain OC user token" + echo -e "-w test suite ${NC} default to load-test"${NC} } oc whoami 1>/dev/null @@ -36,7 +38,7 @@ if [ $? -gt 0 ] ; then fi echo "You are logged in OC: $(oc whoami -c)" -while getopts "c:f:hi:l:n:p:r:t:u:s:v:" opt; do +while getopts "c:f:hi:l:n:p:r:t:u:s:v:w:" opt; do case $opt in h) printHelp exit 0 @@ -63,6 +65,8 @@ while getopts "c:f:hi:l:n:p:r:t:u:s:v:" opt; do ;; v) export cheClusterUrl=$OPTARG ;; + w) export TEST_SUITE=$OPTARG + ;; \?) # invalid option exit 1 ;; @@ -173,7 +177,17 @@ sed -i "s/REPLACE_URL/\"$parsed_url\"/g" template.yaml sed -i "s/REPLACE_TIMESTAMP/\"$TIMESTAMP\"/g" template.yaml sed -i "s/REPLACE_IMAGE/\"$parsed_image\"/g" template.yaml sed -i "s/REPLACE_LOG_LEVEL/$LOG_LEVEL/g" template.yaml - +if [ $TEST_SUITE == "load-test" ]; then + sed -i_.bak '/USERSTORY/d' template.yaml + sed -i "s/REPLACE_TEST_SUITE/$TEST_SUITE/g" template.yaml + sed -i "s/MEMORY_REQUEST/\"900Mi\"/g" template.yaml + sed -i "s/MEMORY_LIMIT/\"900Mi\"/g" template.yaml +else + sed -i_.bak '/TEST_SUITE/d' template.yaml + sed -i "s/REPLACE_USERSTORY/$TEST_SUITE/g" template.yaml + sed -i "s/MEMORY_REQUEST/\"1Gi\"/g" template.yaml + sed -i "s/MEMORY_LIMIT/\"1Gi\"/g" template.yaml +fi # ----------- RUNNING TEST ----------- # echo "-- Running pods with tests." @@ -249,7 +263,6 @@ echo "Pods ended with those statuses: $statuses" # ----------- GATHERING LOGS ----------- # echo "-- Gathering logs." -set -x echo "Syncing files from PVC to local folder." mkdir $FOLDER/$TIMESTAMP cd $FOLDER/$TIMESTAMP diff --git a/tests/performance/pod-oauth.yaml b/tests/performance/pod-oauth.yaml index db6d2772eea..64a93c72761 100644 --- a/tests/performance/pod-oauth.yaml +++ b/tests/performance/pod-oauth.yaml @@ -18,7 +18,9 @@ spec: - name: TS_SELENIUM_BASE_URL value: REPLACE_URL - name: TEST_SUITE - value: load-test + value: REPLACE_TEST_SUITE + - name: USERSTORY + value: REPLACE_USERSTORY - name: TIMESTAMP value: REPLACE_TIMESTAMP - name: TS_SELENIUM_MULTIUSER @@ -43,6 +45,8 @@ spec: value: REPLACE_USERNAME - name: TS_SELENIUM_OCP_PASSWORD value: REPLACE_PASSWORD + - name: TS_SELENIUM_PASSWORD + value: REPLACE_PASSWORD - name: E2E_OPENSHIFT_TOKEN value: REPLACE_TOKEN - name: E2E_OCP_CLUSTER_VERSION @@ -59,14 +63,16 @@ spec: value: "1000000" - name: TS_SELENIUM_WORKSPACE_STATUS_POLLING value: "500000" + - name: TS_LOAD_TESTS + value: "true" image: REPLACE_IMAGE imagePullPolicy: Always name: load-testing-container resources: requests: - memory: "900Mi" + memory: MEMORY_REQUEST cpu: "250m" limits: - memory: "900Mi" + memory: MEMORY_LIMIT cpu: "700m" restartPolicy: Never