Skip to content

test(e2e): drive the suite from a configuration file - #11178

Merged
fcanovai merged 11 commits into
mainfrom
dev/config-based-e2e
Aug 27, 2026
Merged

fcanovai merged 11 commits into
mainfrom
dev/config-based-e2e

Conversation

@armru

@armru armru commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

The e2e suite was configured almost entirely through environment variables (test depth, timeouts, feature filters, cloud vendor, image overrides, storage classes, credentials). That surface had grown hard to manage and didn't support structured or nested settings.

This replaces it with a single YAML file, loaded from tests/e2e/config.yaml or a path passed via --e2e-config. The new tests/config package parses it with a strict decoder, so unknown fields fail immediately instead of being silently ignored. When the file is absent, sane defaults apply (operator default PostgreSQL image, kind vendor, medium depth, autodetected storage classes), so plain ginkgo and IDE runs still work with no setup.

The hack/e2e scripts render the file instead of exporting variables, and the feature-type filter moves into the file as labelFilter, applied through the ginkgo suite configuration. The generated file may contain credentials, so it's git-ignored and written with mode 0600. Values computed at runtime (snapshot, backup, server names) go through an in-process template-variable registry instead of os.Setenv.

No CI workflow changes are needed.

Closes #11189

@armru
armru requested a review from a team July 13, 2026 16:00
@armru armru added the no-issue label Jul 13, 2026
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.28 release-1.29 release-1.30 labels Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@armru

armru commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

/test

@github-actions

Copy link
Copy Markdown
Contributor

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. E2E tests E2E tests tickets for easy triage on release process labels Jul 13, 2026
@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Jul 13, 2026
@NiccoloFei
NiccoloFei force-pushed the dev/config-based-e2e branch 2 times, most recently from 6ea50c3 to ffddde6 Compare July 15, 2026 14:09
@NiccoloFei

Copy link
Copy Markdown
Collaborator

/test

@github-actions

Copy link
Copy Markdown
Contributor

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 31, 2026
@mnencia
mnencia force-pushed the dev/config-based-e2e branch from 8528d7b to 20fb2f6 Compare July 31, 2026 16:38
@mnencia

mnencia commented Jul 31, 2026

Copy link
Copy Markdown
Member

/test

@github-actions

Copy link
Copy Markdown
Contributor

@mnencia

mnencia commented Jul 31, 2026

Copy link
Copy Markdown
Member

@NiccoloFei
NiccoloFei force-pushed the dev/config-based-e2e branch from 20fb2f6 to d87ca5b Compare August 5, 2026 11:19
@fcanovai
fcanovai force-pushed the dev/config-based-e2e branch from d87ca5b to c593869 Compare August 25, 2026 10:14
@fcanovai
fcanovai requested a review from a team as a code owner August 25, 2026 10:14
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Aug 25, 2026
@fcanovai
fcanovai force-pushed the dev/config-based-e2e branch from c593869 to 3160446 Compare August 25, 2026 10:18
@fcanovai

Copy link
Copy Markdown
Contributor

/test tl=4

@github-actions

Copy link
Copy Markdown
Contributor

armru and others added 11 commits August 27, 2026 09:13
Introduce tests/config, which loads a YAML file describing an e2e run:
images, storage classes, cloud vendor, test depth, label filter,
timeouts, credentials, and the knobs of the special test variants.
Unknown fields are rejected so that typos surface immediately instead
of being silently ignored. The package also hosts the registry of
template variables computed while the tests run (snapshot names,
backup names), which the fixture templates consume.

This is the first step towards driving the whole e2e suite from a
configuration file instead of environment variables.

Signed-off-by: Armando Ruocco <[email protected]>
The e2e suite is now configured exclusively through a YAML file,
loaded from tests/e2e/config.yaml or from the path passed via the
--e2e-config flag of the test binary; it no longer reads environment
variables. The run-e2e scripts generate the file from their invocation
environment before each ginkgo run, and the label filter is applied
through the suite configuration instead of the ginkgo command line.

Values computed while the tests run (snapshot names, backup names,
server names) move from process environment variables to an in-process
template-variable registry, so the fixture templates render from the
configuration and from explicitly registered values only. The storage
classes detected from the cluster are written back to the loaded
configuration, replacing the os.Setenv shim that re-exported them for
the helpers reading them through the environment.

Signed-off-by: Armando Ruocco <[email protected]>
Explain that the e2e suite is driven by a configuration file generated
by the hack/e2e scripts, document the file format with an example, and
show how to run the suite directly with a hand-written file.

Signed-off-by: Armando Ruocco <[email protected]>
This allows sourcing the script also from a shell,
instead of relying on callers to define ROOT_DIR.

Signed-off-by: Niccolò Fei <[email protected]>
The ImageRepository are now a bare copy-paste from the config, so
we can drop them and use the config value directly to unify the code.

Signed-off-by: Niccolò Fei <[email protected]>
storage_expansion_test.go, tablespaces_test.go and
backup_restore_azure_test.go read config.Current() directly in their
Describe body. That runs at package-var initialization time, before
TestE2ESuite calls config.Load(), so it always captured the zero-value
defaults instead of the loaded configuration.

Signed-off-by: Marco Nenciarini <[email protected]>
The --label-filter flag it fed was already dropped from the ginkgo
invocation; filtering now goes through the generated configuration
file's labelFilter field instead.

Signed-off-by: Marco Nenciarini <[email protected]>
The autodetected storage-class values were written directly onto the
pointer config.Current() returns, from outside the config package.
Add UpdateStorage and route the writeback through it, so every
mutation of the current configuration stays in config.go rather than
being scattered across callers.

Signed-off-by: Marco Nenciarini <[email protected]>
These specs read env.DefaultStorageClass inline at each use, wrapping it
in ptr.To() every time and, in some cases, without ever asserting that a
storage class was actually detected.

Read it once into a local, assert it is not empty, and take its address
where a pointer is needed. This keeps the emptiness check next to the
value it guards and drops the now-unused k8s.io/utils/ptr import.

Signed-off-by: Francesco Canovai <[email protected]>
…ration

tests/e2e/upgrade_plugin_barman_cloud_test.go was added to main by
"test(e2e): port upgrade tests to plugin-barman-cloud" (#11264) as a copy
of upgrade_test.go, after the suite had been moved onto the configuration
file. It therefore kept reading the process environment, which nothing
populates any more, with two consequences.

Its skip gate tested TEST_SKIP_UPGRADE, a variable the run-e2e scripts
stopped exporting once they started writing skipUpgradeSuite into the
configuration. The gate never fired, so this Ordered/Serial spec ran
during the main suite invocation, where the operator manifests it needs
are not generated.

Its SERVER_NAME, OBJECT_STORE_NAME and RECOVERY_* values were published
with os.Setenv, but GetYAMLContent no longer merges os.Environ() into the
substitution map: it builds it from the configuration and the template
variable registry. envsubst fails hard on an unknown variable, so
rendering cluster1, cluster2 and cluster-restore would have failed.

Read the skip flag and the registry pull secret from the configuration,
and register the template values through config.SetTemplateVariable, as
upgrade_test.go already does.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Francesco Canovai <[email protected]>
The variable list only covered part of what the hack/e2e scripts feed
into the generated configuration file, and the hand-written example
omitted fields the scripts can emit.

Document POSTGRES_IMG_REPOSITORY and POSTGIS_IMG_REPOSITORY, which pin
where the images the suite needs but is not testing come from,
AZURE_BLOB_CONTAINER, TEST_CLOUD_VENDOR, TEST_TIMEOUTS, BRANCH_NAME and
BARMAN_PLUGIN_VERSION_RESOLVED, plus the POSTGRES_MAJOR_UPGRADE_* group
that redirects the major upgrade targets at custom-built images.

Add branchName, deployment.barmanPluginVersionResolved and the four
majorUpgrade suffix fields to the example, so it covers every field the
configuration accepts.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Francesco Canovai <[email protected]>
@fcanovai
fcanovai force-pushed the dev/config-based-e2e branch from 3160446 to c775b31 Compare August 27, 2026 07:13
@fcanovai
fcanovai merged commit 6511d6e into main Aug 27, 2026
36 checks passed
@fcanovai
fcanovai deleted the dev/config-based-e2e branch August 27, 2026 07:33
cnpg-bot pushed a commit that referenced this pull request Aug 27, 2026
The e2e suite was configured almost entirely through environment
variables (test depth, timeouts, feature filters, cloud vendor, image
overrides, storage classes, credentials). That surface had grown hard to
manage and didn't support structured or nested settings.

This replaces it with a single YAML file, loaded from
`tests/e2e/config.yaml` or a path passed via `--e2e-config`. The new
`tests/config` package parses it with a strict decoder, so unknown
fields fail immediately instead of being silently ignored. When the file
is absent, sane defaults apply (operator default PostgreSQL image,
`kind` vendor, medium depth, autodetected storage classes), so plain
`ginkgo` and IDE runs still work with no setup.

The `hack/e2e` scripts render the file instead of exporting variables,
and the feature-type filter moves into the file as `labelFilter`,
applied through the ginkgo suite configuration. The generated file may
contain credentials, so it's git-ignored and written with mode 0600.
Values computed at runtime (snapshot, backup, server names) go through
an in-process template-variable registry instead of `os.Setenv`.

No CI workflow changes are needed.

Closes #11189

---------

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Niccolò Fei <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Signed-off-by: Francesco Canovai <[email protected]>
Co-authored-by: Niccolò Fei <[email protected]>
Co-authored-by: Marco Nenciarini <[email protected]>
Co-authored-by: Francesco Canovai <[email protected]>
(cherry picked from commit 6511d6e)
cnpg-bot pushed a commit that referenced this pull request Aug 27, 2026
The e2e suite was configured almost entirely through environment
variables (test depth, timeouts, feature filters, cloud vendor, image
overrides, storage classes, credentials). That surface had grown hard to
manage and didn't support structured or nested settings.

This replaces it with a single YAML file, loaded from
`tests/e2e/config.yaml` or a path passed via `--e2e-config`. The new
`tests/config` package parses it with a strict decoder, so unknown
fields fail immediately instead of being silently ignored. When the file
is absent, sane defaults apply (operator default PostgreSQL image,
`kind` vendor, medium depth, autodetected storage classes), so plain
`ginkgo` and IDE runs still work with no setup.

The `hack/e2e` scripts render the file instead of exporting variables,
and the feature-type filter moves into the file as `labelFilter`,
applied through the ginkgo suite configuration. The generated file may
contain credentials, so it's git-ignored and written with mode 0600.
Values computed at runtime (snapshot, backup, server names) go through
an in-process template-variable registry instead of `os.Setenv`.

No CI workflow changes are needed.

Closes #11189

---------

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Niccolò Fei <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Signed-off-by: Francesco Canovai <[email protected]>
Co-authored-by: Niccolò Fei <[email protected]>
Co-authored-by: Marco Nenciarini <[email protected]>
Co-authored-by: Francesco Canovai <[email protected]>
(cherry picked from commit 6511d6e)
mnencia added a commit that referenced this pull request Aug 27, 2026
The e2e suite was configured almost entirely through environment
variables (test depth, timeouts, feature filters, cloud vendor, image
overrides, storage classes, credentials). That surface had grown hard to
manage and didn't support structured or nested settings.

This replaces it with a single YAML file, loaded from
`tests/e2e/config.yaml` or a path passed via `--e2e-config`. The new
`tests/config` package parses it with a strict decoder, so unknown
fields fail immediately instead of being silently ignored. When the file
is absent, sane defaults apply (operator default PostgreSQL image,
`kind` vendor, medium depth, autodetected storage classes), so plain
`ginkgo` and IDE runs still work with no setup.

The `hack/e2e` scripts render the file instead of exporting variables,
and the feature-type filter moves into the file as `labelFilter`,
applied through the ginkgo suite configuration. The generated file may
contain credentials, so it's git-ignored and written with mode 0600.
Values computed at runtime (snapshot, backup, server names) go through
an in-process template-variable registry instead of `os.Setenv`.

No CI workflow changes are needed.

Closes #11189

---------

Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Niccolò Fei <[email protected]>
Signed-off-by: Marco Nenciarini <[email protected]>
Signed-off-by: Francesco Canovai <[email protected]>
Co-authored-by: Niccolò Fei <[email protected]>
Co-authored-by: Marco Nenciarini <[email protected]>
Co-authored-by: Francesco Canovai <[email protected]>
(cherry picked from commit 6511d6e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested ◀️ This pull request should be backported to all supported releases E2E tests E2E tests tickets for easy triage on release process lgtm This PR has been approved by a maintainer ok to merge 👌 This PR can be merged release-1.28 release-1.30 size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: E2E - drive the suite from a configuration file instead of environment variables

5 participants