Skip to content

Custom script for image integration tests

Fabien Catteau requested to merge custom-image-test-script into master

What does this MR do?

For the record, it currently takes about 80 seconds to run all the specs we have in spec/image_spec.rb (130 examples). See image test job.

DockerRunner

Changes to DockerRunner:

  • run_with_cache passes all keyword arguments to initialize without repeating the default values.
  • run_with_cache uses all arguments and keyword arguments to create a cache without naming them.
  • initialize accepts an optional command (to override CMD [ARG...]) and an optional script.
  • If specified, the script is saved in the target directory, and executed. In that case the command is simply ignored.

Saving the script in the target directory is a cheap way to make it accessible in the container.

  • Pro: It's really simple, compared to copying the script (docker create, docker cp, docker start, docker rm).
  • Con: This is not really clean, and there's a leftover. That said, this leftover make it easy to re-run the contaner manually.

Another option would be to copy the script to a temp directory, and mount it.

command and script are mutually exclusive, but this is not explicit. Another approach would be to raise an exception when both are set.

Spec for GEMNASIUM_DB_REF_NAME

The new specs for GEMNASIUM_DB_REF_NAME are really close to the job integration tests implemented in https://gitlab.com/gitlab-org/security-products/tests/go-modules/-/blob/advisory-db-scan-time-sync-FREEZE. The Shell script that sets up the "local remote" and the expected have been copied with very few modifications.

What are the relevant issue numbers?

gitlab-org/gitlab#333829 (closed)

Does this MR meet the acceptance criteria?

Edited by Fabien Catteau

Merge request reports