Skip to content

Commit

Permalink
perf(test): Speed up orca-sql tests (spinnaker#3827)
Browse files Browse the repository at this point in the history
* perf(test): Speed up PgSQL tests

When overriding setupSpec, Spock runs both the parent (super.setupSpec)
and the subclass setupSpec (in that order). This means that for the
PgSQL tests, we're creating a MySQL database then immediately discarding
it to replace it with a PgSQL database.

As creating the database spins up a container and is resonably slow,
lightly refactor this so that we don't do this extra work.

* refactor(test): Push some logic down from execution repository tests

There's a lot of coupling between PipelineExecutionRepositoryTck and
its subclasses that causes initialization order dependencies. In order
to make it easier to make changes (such as changing what fields are
updated in setup vs setupSpec), refactor this so that each subclass
is fully responsible for initialization and we can control the order.

The main issue here is that the super class was storing and
initializing the ExecutionRepository, but we can't actually create
the ExecutionRepository until we've created the persistence store,
which is owned by the implementations. So we were subtly depending
on each subclass having already initialized its persistence store
before we create the ExecutionRepository.

Now it's up to each subclass ot handle this order-dependence and
expose a method to get the ExecutionRepository.

* perf(test): Share execution repository among tests

Given that we share the actual persistence between tests, there's
not much benefit to creating a new ExecutionRepository for each
test. Speed the tests up by re-using it between tests.

* perf(test): Remove previous repository from base test

The previous repository is only used in the Jedis tests; remove it
from the base class so we can avoid creating it and cleaning it up
after every test.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
ezimanyi and mergify[bot] authored Jul 23, 2020
1 parent 018db22 commit 669f0e6
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 131 deletions.
Loading

0 comments on commit 669f0e6

Please sign in to comment.