Faster campaigns test. Part 4. Reorganise tests.
Created by: mrnugget
This fixes https://github.com/sourcegraph/sourcegraph/issues/16320 and is the final PR in this sprint for this.
This is not such a big speedup, but it does get rid of a few heavy tests that we've now covered with faster unit tests:
- it splits up the old
TestReconcilerProcess
test into a reconciler integration test that does one high-level test to make sureDeterminePlan
andexecutor.ExecutePlan
are called correctly and everything is persisted - the other test is
TestExecutor_ExecutePlan
which is easier to maintain and to extend, since it doesn't need previous+current spec as input, but a changeset and aReconcilerPlan
- it also extends the
DeterminePlan
tests to make sure that all tests are covered
Both TestExecutor_ExecutePlan
and TestDeterminePlan
are really easy to extend. Thanks again to @eseliger for coming up with this architecture that makes this so easy!
We're now at ~7s, down from ~15s:
$ for i in $(seq 0 5); do time go test ./enterprise/internal/campaigns -count=1; done
ok github.com/sourcegraph/sourcegraph/enterprise/internal/campaigns 7.474s
go test ./enterprise/internal/campaigns -count=1 5.22s user 2.39s system 75% cpu 10.095 total
ok github.com/sourcegraph/sourcegraph/enterprise/internal/campaigns 7.486s
go test ./enterprise/internal/campaigns -count=1 5.34s user 2.32s system 76% cpu 10.023 total
ok github.com/sourcegraph/sourcegraph/enterprise/internal/campaigns 7.433s
go test ./enterprise/internal/campaigns -count=1 5.46s user 2.39s system 79% cpu 9.934 total
ok github.com/sourcegraph/sourcegraph/enterprise/internal/campaigns 7.497s
go test ./enterprise/internal/campaigns -count=1 5.36s user 2.27s system 76% cpu 9.982 total
ok github.com/sourcegraph/sourcegraph/enterprise/internal/campaigns 7.410s
go test ./enterprise/internal/campaigns -count=1 5.43s user 2.36s system 78% cpu 9.928 total
ok github.com/sourcegraph/sourcegraph/enterprise/internal/campaigns 7.562s
go test ./enterprise/internal/campaigns -count=1 5.45s user 2.36s system 76% cpu 10.161 total