Repository navigation
test(e2e): drive the suite from a configuration file - #11178
Conversation
|
❗ By default, the pull request is configured to backport to all release branches.
|
|
/test |
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/29264673122 |
6ea50c3 to
ffddde6
Compare
|
/test |
|
@NiccoloFei, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/29422371100 |
8528d7b to
20fb2f6
Compare
|
/test |
|
@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/30647978009 |
20fb2f6 to
d87ca5b
Compare
d87ca5b to
c593869
Compare
c593869 to
3160446
Compare
|
/test tl=4 |
|
@fcanovai, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/32836605848 |
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]>
3160446 to
c775b31
Compare
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)
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)
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)
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.yamlor a path passed via--e2e-config. The newtests/configpackage 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,kindvendor, medium depth, autodetected storage classes), so plainginkgoand IDE runs still work with no setup.The
hack/e2escripts render the file instead of exporting variables, and the feature-type filter moves into the file aslabelFilter, 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 ofos.Setenv.No CI workflow changes are needed.
Closes #11189