Regenerate expected JSON
What does this MR do?
During gitlab-org/gitlab#390908 (closed) I've found I've needed to refresh the expected JSON regularly.
This MR aims to make that update process easier by integrating it into the rspec tests.
This MR adds the environment variable REFRESH_EXPECTED
. When the rspec tests are run with the variable set to true
, the tests generate new JSON, replace the fields id
, version
, start_time
and end_time
with :SKIP:
(so they aren't included in any comparison 1) and then copies them to the appropriate file in the qa/expect
directory.
Adding :SKIP:
to these fields will make JSON updates in the future easier to visually parse, as :SKIP:
will remove some of the noise.
The MR also includes all the new expected JSON after the regeneration has run.
To run the regeneration
docker run -it --rm -v "$PWD:$PWD" -w "$PWD" \
-e TMP_IMAGE=semgrep \
-e REFRESH_EXPECTED=true \
-v /var/run/docker.sock:/var/run/docker.sock \
registry.gitlab.com/gitlab-org/security-products/analyzers/integration-test:stable rspec
What are the relevant issue numbers?
gitlab-org/gitlab#390908 (closed)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated for GitLab EE, if necessary -
Documentation created/updated for this project, if necessary -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Job definition updated, if necessary -
Conforms to the code review guidelines -
Conforms to the Go guidelines -
Security reports checked/validated by reviewer