image: "python:3.8"

variables:
 neoload_api_url: "https://neoload-api.saas.neotys.com/"
 neoload_token: "specify_token_or_get_it_from_credentials"
 zone_id: "defaultzone"

stages:
 - test

loadtest:
 stage: test
 allow_failure: false
 script:
  - pip3 install neoload
  - neoload --version
  - |
    neoload login --url ${neoload_api_url} ${neoload_token} 
  - |
    neoload test-settings --zone ${zone_id} --scenario sanityScenario patch "My Gitlab Test With CLI" 
  - |
    neoload project --path tests/neoload_projects/example_1/ upload "My Gitlab Test With CLI"
  - |
    neoload run \
            --name "Gitlab pipeline performance regression test $CI_JOB_ID" \
            --external-url "$CI_JOB_URL" \
            --external-url-label "Gitlab build $CI_JOB_ID" \
            --description "Gitlab result description" \
            --web-vu 5 \
            --as-code default.yaml,slas/uat.yaml \
            "My Gitlab Test With CLI"
  - |
    neoload test-results junitsla
