File tree Expand file tree Collapse file tree 9 files changed +26
-7
lines changed
Expand file tree Collapse file tree 9 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,17 @@ func (m *Maintenance) GenerateTestingValues(
174174 targetExtensionImage )
175175 }
176176
177+ var extensions []map [string ]string
178+ var expectedExtensions []map [string ]any
179+ if metadata .CreateExtension {
180+ extensions = []map [string ]string {
181+ {"name" : metadata .SQLName , "version" : version },
182+ }
183+ expectedExtensions = []map [string ]any {
184+ {"applied" : true , "name" : metadata .SQLName },
185+ }
186+ }
187+
177188 // Build values.yaml content
178189 values := map [string ]any {
179190 "name" : metadata .Name ,
@@ -186,6 +197,9 @@ func (m *Maintenance) GenerateTestingValues(
186197 "extension_image" : targetExtensionImage ,
187198 "pg_image" : pgImage ,
188199 "version" : version ,
200+ "create_extension" : metadata .CreateExtension ,
201+ "extensions" : extensions ,
202+ "expected_extensions" : expectedExtensions ,
189203 }
190204 valuesYaml , err := yaml .Marshal (values )
191205 if err != nil {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ type extensionMetadata struct {
2828 DynamicLibraryPath []string `hcl:"dynamic_library_path" cty:"dynamic_library_path"`
2929 LdLibraryPath []string `hcl:"ld_library_path" cty:"ld_library_path"`
3030 AutoUpdateOsLibs bool `hcl:"auto_update_os_libs" cty:"auto_update_os_libs"`
31+ CreateExtension bool `hcl:"create_extension" cty:"create_extension"`
3132 Versions versionMap `hcl:"versions" cty:"versions"`
3233 Remain hcl.Body `hcl:",remain"`
3334}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ metadata = {
77 dynamic_library_path = []
88 ld_library_path = []
99 auto_update_os_libs = false
10+ create_extension = true
1011
1112 versions = {
1213 bookworm = {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ metadata = {
77 dynamic_library_path = []
88 ld_library_path = []
99 auto_update_os_libs = false
10+ create_extension = true
1011
1112 versions = {
1213 bookworm = {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ metadata = {
77 dynamic_library_path = []
88 ld_library_path = [" /system" ]
99 auto_update_os_libs = true
10+ create_extension = true
1011
1112 versions = {
1213 bookworm = {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ metadata = {
99 dynamic_library_path = []
1010 ld_library_path = []
1111 auto_update_os_libs = false
12+ create_extension = true
1213
1314 versions = {
1415 {{- range $distro := .Distros }}
Original file line number Diff line number Diff line change 1313 value : ($values.sql_name)
1414 - name : EXT_VERSION
1515 value : ($values.version)
16+ - name : CREATE_EXTENSION
17+ value : (to_string($values.create_extension))
1618 - name : DB_URI
1719 valueFrom :
1820 secretKeyRef :
2325 args :
2426 - |
2527 set -e
28+ if [ "$CREATE_EXTENSION" != "true" ]; then
29+ echo "Skipping extension check (create_extension=false)"
30+ exit 0
31+ fi
2632 DB_URI=$(echo $DB_URI | sed "s|/\*|/|")
2733 test "$(psql "$DB_URI" -tAc "SELECT EXISTS (SELECT FROM pg_catalog.pg_extension WHERE extname = '${EXT_SQL_NAME}' AND extversion = '${EXT_VERSION}')" -q)" = "t"
2834 echo "Extension '${EXT_SQL_NAME} v${EXT_VERSION}' is installed!"
Original file line number Diff line number Diff line change @@ -4,7 +4,3 @@ metadata:
44 name : (join('-', [$values.name, 'app']))
55status :
66 applied : true
7- extensions :
8- - applied : true
9- name : ($values.sql_name)
10- observedGeneration : 1
Original file line number Diff line number Diff line change 77 owner : app
88 cluster :
99 name : ($values.name)
10- extensions :
11- - name : ($values.sql_name)
12- version : ($values.version)
10+ extensions : ($values.extensions)
You can’t perform that action at this time.
0 commit comments