.test:
  image: python:3.12
  stage: test
  allow_failure: true
  before_script:
    - pip install -r requirements.txt
    - pip install pytest pytest-cov pytest-custom_exit_code httpx
    - cd src/test
  artifacts:
    reports:
      junit: [ '**/report.xml' ]
      coverage_report:
        coverage_format: cobertura
        path: '**/coverage.xml'

test:
  extends: .test
  parallel:
    matrix:
      - TEST_FILE:
          - test_config_token.py
          - test_decrypt.py
          - test_instance_token.py
  script:
    - echo "Testing $TEST_FILE" ...
    - coverage run -m pytest $TEST_FILE --junitxml=report.xml --suppress-no-test-exit-code
    - coverage report $TEST_FILE
    - coverage xml $TEST_FILE

docker:inspect:
  rules:
    - when: manual
  before_script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  script:
    - docker pull $CI_REGISTRY/$CI_PROJECT_PATH/appliance:3.4.1
    - docker inspect $CI_REGISTRY/$CI_PROJECT_PATH/appliance:3.4.1