-
Notifications
You must be signed in to change notification settings - Fork 21
feat: Make CREATE EXTENSION tests optional #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8eef786 to
0c185f5
Compare
60a3587 to
26b1448
Compare
cc2f50c to
b055ea9
Compare
|
I have tried this patch using an extension that doesn't need apiVersion: postgresql.cnpg.io/v1
kind: Database
metadata:
name: (join('-', [$values.name, 'app']))
spec:
name: app
owner: app
cluster:
name: ($values.name)
extensions: ($values.database_config.extensions_spec)In my opinion, this test should be skipped or, if we want to, we should use a template that adds the |
e0af6c6 to
f0b02a0
Compare
|
@mnencia it is not working for me. If I run: task e2e:test:full TARGET=wal2jsonI used this basic Dockerfile: # SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0
ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
FROM $BASE AS builder
ARG PG_MAJOR
ARG EXT_VERSION
USER 0
RUN apt-get update && apt-get install -y --no-install-recommends \
"postgresql-${PG_MAJOR}-wal2json=${EXT_VERSION}"
FROM scratch
ARG PG_MAJOR
# Licenses
# COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-wal2json/copyright /licenses/postgresql-${PG_MAJOR}-wal2json/
# Libraries
# COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/wal2json* /lib/
USER 65532:65532And this metadata: # SPDX-FileCopyrightText: Copyright © contributors to CloudNativePG, established as CloudNativePG a Series of LF Projects, LLC.
# SPDX-License-Identifier: Apache-2.0
metadata = {
name = "wal2json"
sql_name = "wal2json"
image_name = "wal2json"
shared_preload_libraries = []
extension_control_path = []
dynamic_library_path = []
ld_library_path = []
auto_update_os_libs = false
required_extensions = []
create_extension = false
versions = {
trixie = {
// renovate: suite=trixie-pgdg depName=postgresql-18-wal2json
"18" = "2.6-3.pgdg13+1"
}
bookworm = {
// renovate: suite=bookworm-pgdg depName=postgresql-18-wal2json
"18" = "2.6-3.pgdg12+1"
}
}
}I get this result: [e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | ASSERT | ERROR | postgresql.cnpg.io/v1/Database @ chainsaw-innocent-toucan/wal2json-app
[e2e:test-wal2json] === ERROR
[e2e:test-wal2json] --------------------------------------------------------------------
[e2e:test-wal2json] postgresql.cnpg.io/v1/Database/chainsaw-innocent-toucan/wal2json-app
[e2e:test-wal2json] --------------------------------------------------------------------
[e2e:test-wal2json] * status.extensions: Required value: field not found in the input object
[e2e:test-wal2json]
[e2e:test-wal2json] --- expected
[e2e:test-wal2json] +++ actual
[e2e:test-wal2json] @@ -5,6 +5,5 @@
[e2e:test-wal2json] namespace: chainsaw-innocent-toucan
[e2e:test-wal2json] status:
[e2e:test-wal2json] applied: true
[e2e:test-wal2json] - extensions: null
[e2e:test-wal2json] observedGeneration: 1
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | TRY | END |
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | CLEANUP | BEGIN |
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | DELETE | OK | postgresql.cnpg.io/v1/Database @ chainsaw-innocent-toucan/wal2json-app
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | DELETE | OK | postgresql.cnpg.io/v1/Cluster @ chainsaw-innocent-toucan/wal2json
[e2e:test-wal2json] | 03:48:54 | verify-extension | Create a Cluster with the extension | CLEANUP | END |
[e2e:test-wal2json] | 03:48:54 | verify-extension | @chainsaw | CLEANUP | BEGIN |
[e2e:test-wal2json] | 03:48:54 | verify-extension | @chainsaw | DELETE | OK | v1/Namespace @ chainsaw-innocent-toucan
[e2e:test-wal2json] | 03:49:04 | verify-extension | @chainsaw | CLEANUP | END |
[e2e:test-wal2json] --- FAIL: chainsaw (0.00s)
[e2e:test-wal2json] --- FAIL: chainsaw/verify-extension (209.20s)
[e2e:test-wal2json] FAIL
[e2e:test-wal2json] Tests Summary...
[e2e:test-wal2json] - Passed tests 0
[e2e:test-wal2json] - Failed tests 1
[e2e:test-wal2json] - Skipped tests 0
[e2e:test-wal2json] Done with failures.
[e2e:test-wal2json] Stderr:
[e2e:test-wal2json] Error: some tests failed
task: [e2e:test:full] rm -f "./kubeconfig"
task: [e2e:test:full] rm -f "wal2json/values.yaml"
task: [e2e:test:full] rm -f "wal2json/bake-metadata.json"
task: Failed to run task "e2e:test:full": task: Failed to run task "e2e:test": exit status 1
... |
Signed-off-by: Matteo <matteo.biagetti@enterprisedb.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
TestingValues was missing the CreateExtension field, so the generated values.yaml never contained create_extension and the psql verification job always skipped. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Bundle extension metadata with its configuration so generateDatabaseConfig no longer re-parses metadata or re-fetches image annotations for each extension. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Skip extensions with create_extension = false from the Database CR and status assertion entirely, rather than listing them with ensure: absent. Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
f0b02a0 to
48ada15
Compare
|
Sorry Gabriele. I missed pushing the last version of the code. I apologize for the time wasted. |
|
No worries, that's ok. Now everything works! |
Adds a
create_extensionboolean field to extension metadata so that extensions providing only libraries or tools (e.g. wal2json) can skipCREATE EXTENSIONtests. Whencreate_extensionisfalse, the extension is omitted entirely from the Database CR'sextensions_specand the status assertion skips theextensionsfield.The generated
database_assert_statusmap conditionally includes or excludes theextensionskey, avoiding the Chainsaw limitation whereextensions: nullwould require the field to exist in the actual resource. The psql verification job incheck-extension.yamlalso readscreate_extensionand skips when false.Example generated values for
create_extension: true(pgvector):Example generated values for
create_extension: false(wal2json):Closes #85