Commit d1a5d6fb authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: normalize reports

parent 23e9f266
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ Template type: **build** / **analyse** / **package** / **deploy** / **acceptance
* Build & Test job:
    * (type here the used build & test tools/frameworks)
    * [ ] mapped to the `build` stage
    * [ ] unit tests report integration using [JUnit test report](https://docs.gitlab.com/ee/ci/junit_test_reports.html)
    * [ ] unit tests report integration using [JUnit test report](https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsjunit)
    * [ ] code coverage computing and [integration](https://docs.gitlab.com/ee/ci/yaml/#coverage)
    * [ ] optimized [cache](https://docs.gitlab.com/ee/ci/caching/) configuration
* (optional) Code analysis job(s):
@@ -111,7 +111,7 @@ Template type: **build** / **analyse** / **package** / **deploy** / **acceptance

* Acceptance test job:
    * [ ] mapped to the `acceptance` stage
    * [ ] tests report integration using [JUnit test report](https://docs.gitlab.com/ee/ci/junit_test_reports.html)
    * [ ] tests report integration using [JUnit test report](https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsjunit)
    * [ ] auto-evaluating the environment url to test based on the possible upstream `$environment_url` variable or via 
      an `environment_url.txt` file.

+7 −0
Original line number Diff line number Diff line
@@ -36,6 +36,13 @@ It uses the following variables:
| `K6_EXTRA_ARGS`     | k6 extra  [command-line](https://k6.io/docs/getting-started/running-k6)                                   | _none_                 |
| `REVIEW_ENABLED` | Set to `true` to enable k6 tests on review environments (dynamic environments instantiated on development branches) | _none_ (disabled)      |

In addition to a textual report in the console, this job produces the following reports, kept for one day:

| Report         | Format                                                                       | Usage             |
| -------------- | ---------------------------------------------------------------------------- | ----------------- |
| `reports/k6-*.summary.json` | [k6 summary](https://k6.io/docs/using-k6/k6-options/reference/#summary-export) report(s) | [GitLab integration](https://docs.gitlab.com/ee/ci/yaml/artifacts_reports.html#artifactsreportsload_performance) |
| `reports/k6-*.native.json` | [k6 JSON](https://k6.io/docs/results-visualization/json/) detailed stats | - |

### Load performance report integration

k6 test reports are [integrated to GitLab by generating load performance reports](https://docs.gitlab.com/ee/user/project/merge_requests/load_performance_testing.html).
+5 −5
Original line number Diff line number Diff line
@@ -282,23 +282,23 @@ k6:
  before_script:
    - *k6-scripts
    - eval_env_url
    - mkdir -p reports/k6
    - mkdir -p -m 777 reports
  script:
    - |
      for tests_file in $K6_TESTS_DIR/test_*.js
      do
        log_info "Running test \\e[33;1m$test\\e[0m..."
        log_info "Running test \\e[33;1m${tests_file}\\e[0m..."
        namenoext=$(basename $tests_file | sed 's/\..*//')
        k6 run ${TRACE+--verbose} --out json=reports/k6/$namenoext.json $K6_EXTRA_ARGS $tests_file
        k6 run ${TRACE+--verbose} --out json=reports/k6-$namenoext.native.json --summary-export reports/k6-$namenoext.summary.json $K6_EXTRA_ARGS $tests_file
      done
  artifacts:
    name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG"
    when: always
    paths:
      - reports/k6
      - "reports/k6-*"
    reports:
      load_performance:
        - reports/k6/*.json
        - "reports/k6-*.summary.json"
    expire_in: 1 day
  rules:
    - !reference [.acceptance-policy, rules]