Hyperfoil / Horreum

Benchmark results repository service
https://horreum.hyperfoil.io/
Apache License 2.0
39 stars 31 forks source link

Avoid starting up test containers when not required #2039

Closed lampajr closed 1 month ago

lampajr commented 1 month ago

Feature idea.

We should isolate some tests to avoid starting up the whole Horreum infra (including postgres and keycloak containers) when not actually required.

A good example is https://github.com/Hyperfoil/Horreum/blob/37bc00cc7dbe7b45b211ab39a36d31451fb99c11/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/UtilTest.java where we mostly test static methods for which we don't need to start up Horreum infra.

Describe the solution you'd like

Try to reduce the infra setup for tests that do not require it.

Additional information

n/a

barreiro commented 1 month ago

there are already a few test profiles in io.hyperfoil.tools.horreum.test to define sets of required resources. for example, ElasticSearch container does not start for most tests.

in the case of UtilTest, it should not use the HorreumTestProfile or any other profile if those resources are indeed not needed.

lampajr commented 1 month ago

in the case of UtilTest, it should not use the HorreumTestProfile or any other profile if those resources are indeed not needed.

+1 I agree

lampajr commented 1 month ago

@whitingjr I merged https://github.com/Hyperfoil/Horreum/pull/2058 which solves one specific issue, but I would keep this issue opened as I think there might be other tests that require a similar change.

I mean I would consider, as part of this tasks, the evaluation of how many other tests could be simplified

whitingjr commented 1 month ago

@lampajr I scanned through other *Test objects and found they all used an injected field that relies on booted services when preparing the PR. Have you found any other candidates ?

lampajr commented 1 month ago

@lampajr I scanned through other *Test objects and found they all used an injected field that relies on booted services when preparing the PR. Have you found any other candidates ?

Ok then you already did that investigation, that is exactly what I was looking for!

Thus, I think we can close this one :rocket: