Docs - product feedback: K6 script not getting the global __ENV from load_performance job
Summary
Unable to retrieve the value of ENVIRONMENT_URL in the K6 script
Steps to reproduce
Set up the following stages using the Load Performance Testing template,
stages:
- deploy
- performance
include:
template: Verify/Load-Performance-Testing.gitlab-ci.yml
review:
stage: deploy
environment:
name: review/$CI_COMMIT_REF_NAME
url: http://$CI_ENVIRONMENT_SLUG.example.com
script:
- run_deploy_script
- echo "ENVIRONMENT_URL=$CI_ENVIRONMENT_URL" >> review.env
artifacts:
reports:
dotenv:
review.env
load_performance:
dependencies:
- review
variables:
K6_TEST_FILE: ./load-test.js
Retrieve it in the K6 script, with the global __ENV variable,
export default function () {
let res = http.get(`${__ENV.ENVIRONMENT_URL}`);
What is the current bug behavior?
Getting the following error:
time="2020-08-11T06:53:22Z" level=warning msg="Request Failed" error="Get https://undefined: lookup undefined on 10.30.0.2:53: no such host"
time="2020-08-11T06:53:22Z" level=error msg="GoError: invalid response type\n\tat native\n\tat file:///k6/load-test.js:42:28(17)\n"
What is the expected correct behavior?
The http.get(${__ENV.ENVIRONMENT_URL}
) should return the value of the variable set in the deploy job and passed in the artifact $CI_ENVIRONMENT_URL
Relevant logs and/or screenshots
time="2020-08-11T06:53:22Z" level=warning msg="Request Failed" error="Get https://undefined: lookup undefined on 10.30.0.2:53: no such host"
time="2020-08-11T06:53:22Z" level=error msg="GoError: invalid response type\n\tat native\n\tat file:///k6/load-test.js:42:28(17)\n"
Edited by esteban guana