platform icon indicating copy to clipboard operation
platform copied to clipboard

Gitlab controller tests are relying on git.project-hobbit.eu

Open MichaelRoeder opened this issue 6 years ago • 5 comments

Description

The JUnit tests for the GitlabControllerImpl class are relying on our online instance. However, unit tests should not rely on external services and the platform can not be build if the service is not available.

MichaelRoeder avatar Dec 03 '18 20:12 MichaelRoeder

Other currently "online" requirements:

Dependency images from Docker Hub:

  • google/cadvisor
  • rabbitmq
  • redis
  • prom/node-exporter
  • prom/prometheus

Docker images from Docker Hub used it tests:

  • busybox
  • helloworld

For the last two, we can actually build something locally instead.

denkv avatar Jan 15 '19 17:01 denkv

The first 5 requirements are fine as long as they are not used in the tests.

Building something locally has the disadvantage, that we would still need a "base image" unless you want to create an image from scratch (not sure how this is done...). The busybox is something very common used for Docker testing. However, we may want to remove the helloworld since the busybox should be sufficient as a dummy container.

MichaelRoeder avatar Jan 22 '19 10:01 MichaelRoeder

Looked into the case of hello-world image: it's used in the test which tests that missing image (we remove it first) can be pulled by the platform.

denkv avatar Jan 22 '19 14:01 denkv

Since we actually can somewhat rely on Docker Hub being available, we can also automatically spin up GitLab instance locally before running tests.

denkv avatar Apr 15 '20 17:04 denkv

Alternative: a simple GitLab mock just for tests, with a test on an online instance being automatically skipped if it's not available.

denkv avatar Jun 29 '21 13:06 denkv