Skip to content

CI: integration-configs-db duplicates pkg/configs and pkg/ruler unit-test runs #7652

Description

@friedrichg

AI Tool Usage Notice
This issue was drafted with AI assistance. The findings and CI run references
below have been verified against master.

Describe the bug
The integration-configs-db CI job in .github/workflows/test-build-deploy.yml
re-runs the entire test suites of ./pkg/configs/... and ./pkg/ruler/...
that the test job has already executed. Of all the packages it rebuilds, only
pkg/configs/api exercises a different code path — it swaps the in-memory DB
helper for a real Postgres one via the integration build tag on
pkg/configs/db/dbtest. Every other package in the matrix produces a
bit-for-bit identical binary in both jobs and is run twice for no benefit.

The Makefile target backing the job is:

configs-integration-test:
	/bin/bash -c "go test -v -tags 'netgo integration slicelabels' -timeout 10m ./pkg/configs/... ./pkg/ruler/..."

The integration tag only affects pkg/configs/db/dbtest/{unit,integration}.go,
which is imported solely by pkg/configs/api.

To Reproduce

  1. Pick any recent master run, e.g. run 28219749406 (sha d74da2e9).

  2. Compare the test (amd64) job log against integration-configs-db (amd64).
    Both report ok for the same eleven packages:

    pkg/configs
    pkg/configs/api
    pkg/configs/client
    pkg/configs/db
    pkg/configs/userconfig
    pkg/ruler
    pkg/ruler/rulespb
    pkg/ruler/rulestore
    pkg/ruler/rulestore/bucketclient
    pkg/ruler/rulestore/configdb
    pkg/ruler/rulestore/local
    
  3. The verbose log of integration-configs-db shows the same test functions
    Test_Root_OK, Test_PostConfig_CreatesConfig, Test_GetAllConfigs_Empty,
    etc. that already ran under the test job — just against Postgres rather
    than the in-memory backend.

Expected behavior
Only the Postgres-backed code path of pkg/configs/api (or its e2e equivalent)
should be re-executed in a dedicated job. Every other package should be tested
exactly once.

Environment:

  • Infrastructure: GitHub Actions (ubuntu-24.04, ubuntu-24.04-arm)
  • Deployment tool: n/a (CI workflow)

Additional Context
Cost on a typical run (per arch):

  • pkg/ruler alone: ~32–36s of wall time, duplicated.
  • Total redundant work per arch: ~37s; across amd64 + arm64 ≈ ~75s of CI
    wall time per push, plus the docker/postgres setup overhead of the
    integration-configs-db job itself.

Possible fix:

  • Move the Postgres coverage into ./integration/ as a tag-gated e2e test
    (e.g. integration_configs_db), let the existing discover-tags
    integration matrix pick it up, and drop the bespoke
    integration-configs-db job + configs-integration-test Make target.
    This also removes the only place in the repo that conditionally compiles
    test code via a //go:build integration tag swap.

it's a small change and consolidates onto
the same pattern every other Docker-dependent test in the repo already uses.

Metadata

Metadata

Assignees

Labels

ci/cdtype/choreSomething that needs to be done; not a bug or a feature

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions