parameters:
  scenario: ''
  transport: ''
  extra_args: ''
  log_folder_name: ''

steps:

- bash: |
    rm -r ${HORTON_FRAMEWORKROOT}/results
    mkdir ${HORTON_FRAMEWORKROOT}/results &&
    source ${HORTON_FRAMEWORKROOT}/bin/activate_horton &&
    cd ${HORTON_FRAMEWORKROOT}/test-runner &&
    python -u -m pytest -v --scenario ${{ parameters.scenario }} --transport=${{ parameters.transport }} --junitxml=${BUILD_SOURCESDIRECTORY}/results/TEST-${{ parameters.log_folder_name }}.xml -o junit_suite_name=${{ parameters.log_folder_name }} ${{ parameters.extra_args }}
  displayName: 'Run pytest'
  condition: and(succeeded(), ne(variables['skipTest'],'yes'))
  env:
    IOTHUB_E2E_CONNECTION_STRING: $(IOTHUB-E2E-CONNECTION-STRING)
    IOTHUB_E2E_REPO_ADDRESS: $(IOTHUB-E2E-REPO-ADDRESS)
    IOTHUB_E2E_REPO_USER: $(IOTHUB-E2E-REPO-USER)
    IOTHUB_E2E_REPO_PASSWORD: $(IOTHUB-E2E-REPO-PASSWORD)
