From eea6ad212a49db81b57408c1ca6d4bef1bf4c052 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 23 Aug 2024 08:28:10 +0200 Subject: [PATCH 01/12] feat(seeding): adjust seeding from consortia to test Refs: #205 --- .../Data/{use_cases.consortia.json => use_cases.test.json} | 0 ...ified_credential_external_type_detail_versions.test.json} | 0 ...rified_credential_type_assigned_external_types.test.json} | 0 .../Data/verified_credential_type_assigned_kinds.test.json | 0 ...=> verified_credential_type_assigned_use_cases.test.json} | 0 ...n => company_ssi_detail_assigned_documents.unittest.json} | 0 ...i_details.test.json => company_ssi_details.unittest.json} | 0 ...tas.test.json => company_ssi_process_datas.unittest.json} | 0 .../Data/{documents.test.json => documents.unittest.json} | 0 .../{process_steps.test.json => process_steps.unittest.json} | 0 .../Data/{processes.test.json => processes.unittest.json} | 0 ...d_credential_external_type_detail_versions.unittest.json} | 0 .../verified_credential_type_assigned_kinds.unittest.json | 0 ...erified_credential_type_assigned_use_cases.unittest.json} | 0 .../Setup/TestDbFixture.cs | 2 +- .../Controllers/IssuerControllerTests.cs | 5 ++--- 16 files changed, 3 insertions(+), 4 deletions(-) rename src/database/SsiCredentialIssuer.Migrations/Seeder/Data/{use_cases.consortia.json => use_cases.test.json} (100%) rename src/database/SsiCredentialIssuer.Migrations/Seeder/Data/{verified_credential_external_type_detail_versions.consortia.json => verified_credential_external_type_detail_versions.test.json} (100%) rename src/database/SsiCredentialIssuer.Migrations/Seeder/Data/{verified_credential_type_assigned_external_types.consortia.json => verified_credential_type_assigned_external_types.test.json} (100%) rename {tests/database/SsiCredentialIssuer.DbAccess.Tests => src/database/SsiCredentialIssuer.Migrations}/Seeder/Data/verified_credential_type_assigned_kinds.test.json (100%) rename src/database/SsiCredentialIssuer.Migrations/Seeder/Data/{verified_credential_type_assigned_use_cases.consortia.json => verified_credential_type_assigned_use_cases.test.json} (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{company_ssi_detail_assigned_documents.test.json => company_ssi_detail_assigned_documents.unittest.json} (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{company_ssi_details.test.json => company_ssi_details.unittest.json} (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{company_ssi_process_datas.test.json => company_ssi_process_datas.unittest.json} (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{documents.test.json => documents.unittest.json} (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{process_steps.test.json => process_steps.unittest.json} (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{processes.test.json => processes.unittest.json} (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{verified_credential_external_type_detail_versions.test.json => verified_credential_external_type_detail_versions.unittest.json} (100%) rename src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.consortia.json => tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_kinds.unittest.json (100%) rename tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/{verified_credential_type_assigned_use_cases.test.json => verified_credential_type_assigned_use_cases.unittest.json} (100%) diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.consortia.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.test.json similarity index 100% rename from src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.consortia.json rename to src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.test.json diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.consortia.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.test.json similarity index 100% rename from src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.consortia.json rename to src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.test.json diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.consortia.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.test.json similarity index 100% rename from src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.consortia.json rename to src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.test.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_kinds.test.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.test.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_kinds.test.json rename to src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.test.json diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.consortia.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.test.json similarity index 100% rename from src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.consortia.json rename to src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.test.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_detail_assigned_documents.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_detail_assigned_documents.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_detail_assigned_documents.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_detail_assigned_documents.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_details.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_details.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_details.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_details.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_process_datas.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_process_datas.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_process_datas.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/company_ssi_process_datas.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/documents.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/documents.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/documents.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/documents.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/process_steps.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/processes.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/processes.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/processes.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/processes.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_external_type_detail_versions.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_external_type_detail_versions.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_external_type_detail_versions.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_external_type_detail_versions.unittest.json diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.consortia.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_kinds.unittest.json similarity index 100% rename from src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.consortia.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_kinds.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_use_cases.test.json b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_use_cases.unittest.json similarity index 100% rename from tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_use_cases.test.json rename to tests/database/SsiCredentialIssuer.DbAccess.Tests/Seeder/Data/verified_credential_type_assigned_use_cases.unittest.json diff --git a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Setup/TestDbFixture.cs b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Setup/TestDbFixture.cs index cbd762c9..5d3c7ff0 100644 --- a/tests/database/SsiCredentialIssuer.DbAccess.Tests/Setup/TestDbFixture.cs +++ b/tests/database/SsiCredentialIssuer.DbAccess.Tests/Setup/TestDbFixture.cs @@ -92,7 +92,7 @@ await _container.StartAsync() var seederOptions = Options.Create(new SeederSettings { - TestDataEnvironments = new[] { "test" }, + TestDataEnvironments = new[] { "unittest" }, DataPaths = new[] { "Seeder/Data" } }); var insertSeeder = new BatchInsertSeeder(context, diff --git a/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs b/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs index b567bc8c..1d4dfd4c 100644 --- a/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs +++ b/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs @@ -47,10 +47,9 @@ public async Task GetCertificateTypes() var types = await _client.GetFromJsonAsync>($"{BaseUrl}/certificateTypes", JsonOptions); // Assert - types.Should().NotBeNull().And.HaveCount(3).And.Satisfy( + types.Should().NotBeNull().And.HaveCount(2).And.Satisfy( x => x == VerifiedCredentialTypeId.MEMBERSHIP, - x => x == VerifiedCredentialTypeId.BUSINESS_PARTNER_NUMBER, - x => x == VerifiedCredentialTypeId.FRAMEWORK_AGREEMENT + x => x == VerifiedCredentialTypeId.BUSINESS_PARTNER_NUMBER ); } From 44bd272e20c7da44954fd77ac30c3013ab2f6247 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Tue, 10 Sep 2024 15:10:58 +0200 Subject: [PATCH 02/12] chore: remove test seeding files Refs: #205 --- .../Seeder/Data/use_cases.test.json | 7 ------- ...ial_external_type_detail_versions.test.json | 18 ------------------ ...tial_type_assigned_external_types.test.json | 6 ------ ...ed_credential_type_assigned_kinds.test.json | 6 ------ ...redential_type_assigned_use_cases.test.json | 6 ------ .../Controllers/IssuerControllerTests.cs | 5 +++-- 6 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.test.json delete mode 100644 src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.test.json delete mode 100644 src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.test.json delete mode 100644 src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.test.json delete mode 100644 src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.test.json diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.test.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.test.json deleted file mode 100644 index c62ba180..00000000 --- a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/use_cases.test.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", - "name": "None", - "shortname": "None" - } -] \ No newline at end of file diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.test.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.test.json deleted file mode 100644 index c5700a2f..00000000 --- a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_external_type_detail_versions.test.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "id": "d0f05b79-792c-4cb8-9b8d-6e476ac2e926", - "verified_credential_external_type_id": 2, - "version": "0.0", - "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf", - "valid_from": "2023-01-01 00:00:00.000000 +00:00", - "expiry": "2023-12-31 00:00:00.000000 +00:00" - }, - { - "id": "2d17a933-f65f-49cd-84a9-cff299a79f85", - "verified_credential_external_type_id": 11, - "version": "1.0", - "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/example.pdf", - "valid_from": "2024-10-16 00:00:00.000000 +00:00", - "expiry": "2025-10-16 00:00:00.000000 +00:00" - } -] diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.test.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.test.json deleted file mode 100644 index 45799aaa..00000000 --- a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.test.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "verified_credential_external_type_id": 11, - "verified_credential_type_id": 11 - } -] diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.test.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.test.json deleted file mode 100644 index 190509de..00000000 --- a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.test.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "verified_credential_type_id": 11, - "verified_credential_type_kind_id": 1 - } -] diff --git a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.test.json b/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.test.json deleted file mode 100644 index 6eac641d..00000000 --- a/src/database/SsiCredentialIssuer.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.test.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "verified_credential_type_id": 11, - "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9" - } -] diff --git a/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs b/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs index 1d4dfd4c..b567bc8c 100644 --- a/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs +++ b/tests/issuer/SsiCredentialIssuer.Service.Tests/Controllers/IssuerControllerTests.cs @@ -47,9 +47,10 @@ public async Task GetCertificateTypes() var types = await _client.GetFromJsonAsync>($"{BaseUrl}/certificateTypes", JsonOptions); // Assert - types.Should().NotBeNull().And.HaveCount(2).And.Satisfy( + types.Should().NotBeNull().And.HaveCount(3).And.Satisfy( x => x == VerifiedCredentialTypeId.MEMBERSHIP, - x => x == VerifiedCredentialTypeId.BUSINESS_PARTNER_NUMBER + x => x == VerifiedCredentialTypeId.BUSINESS_PARTNER_NUMBER, + x => x == VerifiedCredentialTypeId.FRAMEWORK_AGREEMENT ); } From cfa67e1859d4b40298d5733d0a587c5be811e9c3 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 13 Sep 2024 10:15:17 +0200 Subject: [PATCH 03/12] chore: add config maps for test seeding data Refs: #205 --- .../templates/job-issuer-migrations.yaml | 10 ++++- charts/ssi-credential-issuer/values.yaml | 8 ++-- .../argocd-app-templates/appsetup-int.yaml | 42 +++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index 6d462739..f56ff316 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -70,11 +70,17 @@ spec: - name: "SEEDING__TESTDATAENVIRONMENTS__0" value: "{{ .Values.migrations.seeding.testDataEnvironments }}" - name: "SEEDING__DATAPATHS__0" - value: "{{ .Values.migrations.seeding.testDataPaths }}" + value: "Seeder/Data" + {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + - name: "SEEDING__DATAPATHS__1" + value: "Seeder/Data/import" + - name: "SEEDING__TESTDATAENVIRONMENTS__1" + value: "{{ .Values.migrations.seeding.testData.filename }}" + {{- end }} - name: "SERILOG__MINIMUMLEVEL__Default" value: "{{ .Values.migrations.logging.default }}" - name: "PROCESSIDENTITY__IDENTITYID" - value: "{{ .Values.migrations.processIdentity.identityId }}" + value: "ac1cf001-7fbc-1f2f-817f-bce058020006" ports: - name: http containerPort: {{ .Values.portContainer }} diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index 62c90f23..532a13e2 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -88,11 +88,13 @@ migrations: memory: 200M seeding: testDataEnvironments: "" - testDataPaths: "Seeder/Data" + testData: + # -- ConfigMap containing json files for the tables to seed, e.g. companies.test.json, addresses.test.json, etc. + configMap: "" + # -- Filename identifying the test data files e.g. for companies.test.json the value would be "test" + filename: "" logging: default: "Information" - processIdentity: - identityId: ac1cf001-7fbc-1f2f-817f-bce058020006 processesworker: name: "processesworker" diff --git a/environments/argocd-app-templates/appsetup-int.yaml b/environments/argocd-app-templates/appsetup-int.yaml index 15d826e9..0b400692 100644 --- a/environments/argocd-app-templates/appsetup-int.yaml +++ b/environments/argocd-app-templates/appsetup-int.yaml @@ -36,3 +36,45 @@ spec: - name: helm_args value: '-f values.yaml -f ../../environments/helm-values/values-int.yaml' project: project-portal +data: + use_cases.test.json: |- + [ + { + "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", + "name": "None", + "shortname": "None" + } + ] + verified_credential_external_type_detail_versions.test.json: |- + [ + { + "id": "d0f05b79-792c-4cb8-9b8d-6e476ac2e926", + "verified_credential_external_type_id": 2, + "version": "0.0", + "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf", + "valid_from": "2023-01-01 00:00:00.000000 +00:00", + "expiry": "2023-12-31 00:00:00.000000 +00:00" + }, + { + "id": "2d17a933-f65f-49cd-84a9-cff299a79f85", + "verified_credential_external_type_id": 11, + "version": "1.0", + "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/example.pdf", + "valid_from": "2024-10-16 00:00:00.000000 +00:00", + "expiry": "2025-10-16 00:00:00.000000 +00:00" + } + ] + verified_credential_type_assigned_external_types.test.json: |- + [ + { + "verified_credential_external_type_id": 11, + "verified_credential_type_id": 11 + } + ] + verified_credential_type_assigned_use_cases.test.json: |- + [ + { + "verified_credential_type_id": 11, + "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9" + } + ] From 9ef186eac2703e6b9032bc1bee2544bbb079272d Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Tue, 24 Sep 2024 07:55:50 +0200 Subject: [PATCH 04/12] feat(seeding): move configmap into own file Refs: #205 --- .../templates/configmap-seeding-testdata.yaml | 66 +++++++++++++++++++ .../templates/job-issuer-migrations.yaml | 1 + charts/ssi-credential-issuer/values.yaml | 2 +- .../argocd-app-templates/appsetup-int.yaml | 42 ------------ environments/helm-values/values-int.yaml | 3 + 5 files changed, 71 insertions(+), 43 deletions(-) create mode 100644 charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml diff --git a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml new file mode 100644 index 00000000..9defa08d --- /dev/null +++ b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml @@ -0,0 +1,66 @@ +{{- /* +* Copyright (c) 2024 Contributors to the Eclipse Foundation +* +* See the NOTICE file(s) distributed with this work for additional +* information regarding copyright ownership. +* +* This program and the accompanying materials are made available under the +* terms of the Apache License, Version 2.0 which is available at +* https://www.apache.org/licenses/LICENSE-2.0. +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +* License for the specific language governing permissions and limitations +* under the License. +* +* SPDX-License-Identifier: Apache-2.0 +*/}} + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-issuer-cm-seeding-testdata + namespace: {{ .Release.Namespace }} +data: + use_cases.test.json: |- + [ + { + "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", + "name": "None", + "shortname": "None" + } + ] + verified_credential_external_type_detail_versions.test.json: |- + [ + { + "id": "d0f05b79-792c-4cb8-9b8d-6e476ac2e926", + "verified_credential_external_type_id": 2, + "version": "0.0", + "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf", + "valid_from": "2023-01-01 00:00:00.000000 +00:00", + "expiry": "2023-12-31 00:00:00.000000 +00:00" + }, + { + "id": "2d17a933-f65f-49cd-84a9-cff299a79f85", + "verified_credential_external_type_id": 11, + "version": "1.0", + "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/example.pdf", + "valid_from": "2024-10-16 00:00:00.000000 +00:00", + "expiry": "2025-10-16 00:00:00.000000 +00:00" + } + ] + verified_credential_type_assigned_external_types.test.json: |- + [ + { + "verified_credential_external_type_id": 11, + "verified_credential_type_id": 11 + } + ] + verified_credential_type_assigned_use_cases.test.json: |- + [ + { + "verified_credential_type_id": 11, + "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9" + } + ] diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index f56ff316..ac24cf15 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -87,3 +87,4 @@ spec: protocol: TCP resources: {{- toYaml .Values.migrations.resources | nindent 10 }} + {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index 532a13e2..2908d801 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -89,7 +89,7 @@ migrations: seeding: testDataEnvironments: "" testData: - # -- ConfigMap containing json files for the tables to seed, e.g. companies.test.json, addresses.test.json, etc. + # -- ConfigMap containing json files for the tables to seed, e.g. use_cases.json, verified_credential_external_type_detail_versions.test.json, etc. configMap: "" # -- Filename identifying the test data files e.g. for companies.test.json the value would be "test" filename: "" diff --git a/environments/argocd-app-templates/appsetup-int.yaml b/environments/argocd-app-templates/appsetup-int.yaml index 0b400692..15d826e9 100644 --- a/environments/argocd-app-templates/appsetup-int.yaml +++ b/environments/argocd-app-templates/appsetup-int.yaml @@ -36,45 +36,3 @@ spec: - name: helm_args value: '-f values.yaml -f ../../environments/helm-values/values-int.yaml' project: project-portal -data: - use_cases.test.json: |- - [ - { - "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", - "name": "None", - "shortname": "None" - } - ] - verified_credential_external_type_detail_versions.test.json: |- - [ - { - "id": "d0f05b79-792c-4cb8-9b8d-6e476ac2e926", - "verified_credential_external_type_id": 2, - "version": "0.0", - "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/231016_Catena-X_Use_Case_Framework_PCF.pdf", - "valid_from": "2023-01-01 00:00:00.000000 +00:00", - "expiry": "2023-12-31 00:00:00.000000 +00:00" - }, - { - "id": "2d17a933-f65f-49cd-84a9-cff299a79f85", - "verified_credential_external_type_id": 11, - "version": "1.0", - "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Governance_Framework/example.pdf", - "valid_from": "2024-10-16 00:00:00.000000 +00:00", - "expiry": "2025-10-16 00:00:00.000000 +00:00" - } - ] - verified_credential_type_assigned_external_types.test.json: |- - [ - { - "verified_credential_external_type_id": 11, - "verified_credential_type_id": 11 - } - ] - verified_credential_type_assigned_use_cases.test.json: |- - [ - { - "verified_credential_type_id": 11, - "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9" - } - ] diff --git a/environments/helm-values/values-int.yaml b/environments/helm-values/values-int.yaml index ef8b970c..5f17b96b 100644 --- a/environments/helm-values/values-int.yaml +++ b/environments/helm-values/values-int.yaml @@ -58,6 +58,9 @@ service: migrations: logging: default: "Debug" + testData: + configMap: "{{ .Release.Name }}-issuer-cm-seeding-testdata" + filename: "test" processesworker: logging: From 60f79035b7f7a5fb6e20b953d9fdd3987e0218d9 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Tue, 24 Sep 2024 15:21:18 +0200 Subject: [PATCH 05/12] feat: adjust config map configuration Refs: #205 --- .../templates/configmap-seeding-testdata.yaml | 2 + .../templates/job-issuer-migrations.yaml | 46 +++++++++++++++++-- charts/ssi-credential-issuer/values.yaml | 1 + environments/helm-values/values-int.yaml | 3 +- 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml index 9defa08d..c60cf375 100644 --- a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml +++ b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 */}} +{{- if .Values.migrations.seeding.testData.useDefaultTestData -}} apiVersion: v1 kind: ConfigMap metadata: @@ -64,3 +65,4 @@ data: "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9" } ] +{{- end -}} diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index ac24cf15..f31e0fc2 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -70,12 +70,25 @@ spec: - name: "SEEDING__TESTDATAENVIRONMENTS__0" value: "{{ .Values.migrations.seeding.testDataEnvironments }}" - name: "SEEDING__DATAPATHS__0" - value: "Seeder/Data" + value: "Seeder/Data" + {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + - name: "SEEDING__DATAPATHS__1" + value: "Seeder/Data/import/default" + - name: "SEEDING__TESTDATAENVIRONMENTS__1" + value: "test" + {{- end }} {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + - name: "SEEDING__DATAPATHS__2" + value: "Seeder/Data/import/custom" + - name: "SEEDING__TESTDATAENVIRONMENTS__2" + value: "{{ .Values.migrations.seeding.testData.filename }}" + {{ else }} - name: "SEEDING__DATAPATHS__1" - value: "Seeder/Data/import" + value: "Seeder/Data/import/custom" - name: "SEEDING__TESTDATAENVIRONMENTS__1" - value: "{{ .Values.migrations.seeding.testData.filename }}" + value: "{{ .Values.migrations.seeding.testData.filename }}" + {{- end }} {{- end }} - name: "SERILOG__MINIMUMLEVEL__Default" value: "{{ .Values.migrations.logging.default }}" @@ -87,4 +100,29 @@ spec: protocol: TCP resources: {{- toYaml .Values.migrations.resources | nindent 10 }} - {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + {{- if or (.Values.migrations.seeding.testData.useDefaultTestData) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} + volumeMounts: + {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + - name: test-data-default + mountPath: /migrations/Seeder/Data/import/default + {{- end }} + {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + - name: test-data-custom + mountPath: /migrations/Seeder/Data/import/custom + {{- end }} + {{- end }} + {{- if or (.Values.migrations.seeding.testData.useDefaultTestData) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} + volumes: + {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + - name: test-data-default + configMap: + name: "{{ .Release.Name }}-issuer-cm-seeding-testdata" + optional: true + {{- end }} + {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + - name: test-data-custom + configMap: + name: "{{ .Values.migrations.seeding.testData.configMap }}" + optional: true + {{- end }} + {{- end }} diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index 2908d801..873978fc 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -89,6 +89,7 @@ migrations: seeding: testDataEnvironments: "" testData: + useDefaultTestData: false # -- ConfigMap containing json files for the tables to seed, e.g. use_cases.json, verified_credential_external_type_detail_versions.test.json, etc. configMap: "" # -- Filename identifying the test data files e.g. for companies.test.json the value would be "test" diff --git a/environments/helm-values/values-int.yaml b/environments/helm-values/values-int.yaml index 5f17b96b..4cb7ff2d 100644 --- a/environments/helm-values/values-int.yaml +++ b/environments/helm-values/values-int.yaml @@ -59,8 +59,7 @@ migrations: logging: default: "Debug" testData: - configMap: "{{ .Release.Name }}-issuer-cm-seeding-testdata" - filename: "test" + useDefaultTestData: true processesworker: logging: From 50feaef381671e1e6032bcbe9dfe77016d30b753 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Tue, 24 Sep 2024 17:22:16 +0200 Subject: [PATCH 06/12] build: adjust configuration for default testdata Refs: #205 --- .../templates/configmap-seeding-testdata.yaml | 12 ++++----- .../templates/job-issuer-migrations.yaml | 26 +++++++++---------- charts/ssi-credential-issuer/values.yaml | 3 ++- environments/helm-values/values-int.yaml | 2 +- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml index c60cf375..b012d070 100644 --- a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml +++ b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml @@ -17,14 +17,14 @@ * SPDX-License-Identifier: Apache-2.0 */}} -{{- if .Values.migrations.seeding.testData.useDefaultTestData -}} +{{- if .Values.migrations.seeding.testData.useDefault -}} apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-issuer-cm-seeding-testdata + name: {{ include "issuer.fullname" . }}-default-testdata namespace: {{ .Release.Namespace }} data: - use_cases.test.json: |- + use_cases.defaulttest.json: |- [ { "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", @@ -32,7 +32,7 @@ data: "shortname": "None" } ] - verified_credential_external_type_detail_versions.test.json: |- + verified_credential_external_type_detail_versions.defaulttest.json: |- [ { "id": "d0f05b79-792c-4cb8-9b8d-6e476ac2e926", @@ -51,14 +51,14 @@ data: "expiry": "2025-10-16 00:00:00.000000 +00:00" } ] - verified_credential_type_assigned_external_types.test.json: |- + verified_credential_type_assigned_external_types.defaulttest.json: |- [ { "verified_credential_external_type_id": 11, "verified_credential_type_id": 11 } ] - verified_credential_type_assigned_use_cases.test.json: |- + verified_credential_type_assigned_use_cases.defaulttest.json: |- [ { "verified_credential_type_id": 11, diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index f31e0fc2..df6fc0cc 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -71,21 +71,21 @@ spec: value: "{{ .Values.migrations.seeding.testDataEnvironments }}" - name: "SEEDING__DATAPATHS__0" value: "Seeder/Data" - {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: "SEEDING__DATAPATHS__1" - value: "Seeder/Data/import/default" + value: "Seeder/Data/import/default-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__1" - value: "test" + value: "defaulttest" {{- end }} {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} - {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: "SEEDING__DATAPATHS__2" - value: "Seeder/Data/import/custom" + value: "Seeder/Data/import/custom-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__2" value: "{{ .Values.migrations.seeding.testData.filename }}" {{ else }} - name: "SEEDING__DATAPATHS__1" - value: "Seeder/Data/import/custom" + value: "Seeder/Data/import/custom-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__1" value: "{{ .Values.migrations.seeding.testData.filename }}" {{- end }} @@ -100,23 +100,23 @@ spec: protocol: TCP resources: {{- toYaml .Values.migrations.resources | nindent 10 }} - {{- if or (.Values.migrations.seeding.testData.useDefaultTestData) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} + {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} volumeMounts: - {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: test-data-default - mountPath: /migrations/Seeder/Data/import/default + mountPath: /migrations/Seeder/Data/import/default-test-data {{- end }} {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} - name: test-data-custom - mountPath: /migrations/Seeder/Data/import/custom + mountPath: /migrations/Seeder/Data/import/custom-test-data {{- end }} {{- end }} - {{- if or (.Values.migrations.seeding.testData.useDefaultTestData) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} + {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} volumes: - {{- if (.Values.migrations.seeding.testData.useDefaultTestData) }} + {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: test-data-default configMap: - name: "{{ .Release.Name }}-issuer-cm-seeding-testdata" + name: "{{ include "issuer.fullname" . }}-default-testdata" optional: true {{- end }} {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index 873978fc..ae75427b 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -89,7 +89,8 @@ migrations: seeding: testDataEnvironments: "" testData: - useDefaultTestData: false + # -- If set to true the data configured in the config map 'configmap-seeding-testdata.yaml' will be taken to insert the default test data + useDefault: false # -- ConfigMap containing json files for the tables to seed, e.g. use_cases.json, verified_credential_external_type_detail_versions.test.json, etc. configMap: "" # -- Filename identifying the test data files e.g. for companies.test.json the value would be "test" diff --git a/environments/helm-values/values-int.yaml b/environments/helm-values/values-int.yaml index 4cb7ff2d..bb7e39cb 100644 --- a/environments/helm-values/values-int.yaml +++ b/environments/helm-values/values-int.yaml @@ -59,7 +59,7 @@ migrations: logging: default: "Debug" testData: - useDefaultTestData: true + useDefault: true processesworker: logging: From fe0e52fc937e9a5448c7f740420e5a6491a04149 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Thu, 26 Sep 2024 08:34:14 +0200 Subject: [PATCH 07/12] build: add useOwnConfigMap Refs: #205 --- .../templates/job-issuer-migrations.yaml | 16 ++++++++-------- charts/ssi-credential-issuer/values.yaml | 9 +++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index df6fc0cc..d147ac6c 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -77,17 +77,17 @@ spec: - name: "SEEDING__TESTDATAENVIRONMENTS__1" value: "defaulttest" {{- end }} - {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: "SEEDING__DATAPATHS__2" value: "Seeder/Data/import/custom-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__2" - value: "{{ .Values.migrations.seeding.testData.filename }}" + value: "{{ .Values.migrations.seeding.testData.useOwnConfigMap.filename }}" {{ else }} - name: "SEEDING__DATAPATHS__1" value: "Seeder/Data/import/custom-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__1" - value: "{{ .Values.migrations.seeding.testData.filename }}" + value: "{{ .Values.migrations.seeding.testData.useOwnConfigMap.filename }}" {{- end }} {{- end }} - name: "SERILOG__MINIMUMLEVEL__Default" @@ -100,18 +100,18 @@ spec: protocol: TCP resources: {{- toYaml .Values.migrations.resources | nindent 10 }} - {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} + {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename)) }} volumeMounts: {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: test-data-default mountPath: /migrations/Seeder/Data/import/default-test-data {{- end }} - {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} - name: test-data-custom mountPath: /migrations/Seeder/Data/import/custom-test-data {{- end }} {{- end }} - {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename)) }} + {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename)) }} volumes: {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: test-data-default @@ -119,10 +119,10 @@ spec: name: "{{ include "issuer.fullname" . }}-default-testdata" optional: true {{- end }} - {{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.filename) }} + {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} - name: test-data-custom configMap: - name: "{{ .Values.migrations.seeding.testData.configMap }}" + name: "{{ .Values.migrations.seeding.testData.useOwnConfigMap.configMap }}" optional: true {{- end }} {{- end }} diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index ae75427b..59ca30e7 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -91,10 +91,11 @@ migrations: testData: # -- If set to true the data configured in the config map 'configmap-seeding-testdata.yaml' will be taken to insert the default test data useDefault: false - # -- ConfigMap containing json files for the tables to seed, e.g. use_cases.json, verified_credential_external_type_detail_versions.test.json, etc. - configMap: "" - # -- Filename identifying the test data files e.g. for companies.test.json the value would be "test" - filename: "" + useOwnConfigMap: + # -- ConfigMap containing json files for the tables to seed, e.g. use_cases.json, verified_credential_external_type_detail_versions.test.json, etc. + configMap: "" + # -- Filename identifying the test data files e.g. for companies.test.json the value would be "test" + filename: "" logging: default: "Information" From 58f4d44c43364ddb32ae9016497397385f8f1b9b Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Thu, 26 Sep 2024 17:47:52 +0200 Subject: [PATCH 08/12] chore: remove white space --- .../templates/configmap-seeding-testdata.yaml | 2 +- .../templates/job-issuer-migrations.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml index b012d070..e53e7cae 100644 --- a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml +++ b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml @@ -21,7 +21,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "issuer.fullname" . }}-default-testdata + name: {{ include "issuer.fullname" . }}-default-testdata namespace: {{ .Release.Namespace }} data: use_cases.defaulttest.json: |- diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index d147ac6c..4ce4e8ab 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -76,14 +76,14 @@ spec: value: "Seeder/Data/import/default-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__1" value: "defaulttest" - {{- end }} + {{- end }} {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: "SEEDING__DATAPATHS__2" value: "Seeder/Data/import/custom-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__2" value: "{{ .Values.migrations.seeding.testData.useOwnConfigMap.filename }}" - {{ else }} + {{- else }} - name: "SEEDING__DATAPATHS__1" value: "Seeder/Data/import/custom-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__1" @@ -116,7 +116,7 @@ spec: {{- if (.Values.migrations.seeding.testData.useDefault) }} - name: test-data-default configMap: - name: "{{ include "issuer.fullname" . }}-default-testdata" + name: "{{ include "issuer.fullname" . }}-default-testdata" optional: true {{- end }} {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} From 8f7b2b69b5fd80975a6832939fd2102993834c50 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 27 Sep 2024 08:17:06 +0200 Subject: [PATCH 09/12] build: adjust chart configuration Refs: #205 --- charts/ssi-credential-issuer/README.md | 4 +- .../templates/configmap-seeding-testdata.yaml | 2 +- .../templates/job-issuer-migrations.yaml | 38 +++++++++---------- charts/ssi-credential-issuer/values.yaml | 4 +- environments/helm-values/values-int.yaml | 3 +- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/charts/ssi-credential-issuer/README.md b/charts/ssi-credential-issuer/README.md index 6e2c8747..3273cb4c 100644 --- a/charts/ssi-credential-issuer/README.md +++ b/charts/ssi-credential-issuer/README.md @@ -76,8 +76,8 @@ dependencies: | migrations.image.pullSecrets | list | `[]` | | | migrations.imagePullPolicy | string | `"IfNotPresent"` | | | migrations.resources | object | `{"limits":{"cpu":"45m","memory":"200M"},"requests":{"cpu":"15m","memory":"200M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| migrations.seeding.testDataEnvironments | string | `""` | | -| migrations.seeding.testDataPaths | string | `"Seeder/Data"` | | +| migrations.seeding.seedTestDataEnvironments | string | `""` | | +| migrations.seeding.seedTestDataPaths | string | `"Seeder/Data"` | | | migrations.logging.default | string | `"Information"` | | | migrations.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | | processesworker.name | string | `"processesworker"` | | diff --git a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml index e53e7cae..a0a8c00d 100644 --- a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml +++ b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml @@ -17,7 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 */}} -{{- if .Values.migrations.seeding.testData.useDefault -}} +{{- if .Values.migrations.seeding.seedTestData.useDefault -}} apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index 4ce4e8ab..b48d3484 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -67,27 +67,23 @@ spec: - name: "CONNECTIONSTRINGS__ISSUERDB" value: "Server={{ .Values.externalDatabase.host }};Database={{ .Values.externalDatabase.database }};Port={{ .Values.externalDatabase.port }};User Id={{ .Values.externalDatabase.username }};Password=$(ISSUER_PASSWORD);Ssl Mode={{ .Values.dbConnection.sslMode }};" {{- end }} - - name: "SEEDING__TESTDATAENVIRONMENTS__0" - value: "{{ .Values.migrations.seeding.testDataEnvironments }}" + {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - name: "SEEDING__DATAPATHS__0" - value: "Seeder/Data" - {{- if (.Values.migrations.seeding.testData.useDefault) }} - - name: "SEEDING__DATAPATHS__1" value: "Seeder/Data/import/default-test-data" - - name: "SEEDING__TESTDATAENVIRONMENTS__1" + - name: "SEEDING__TESTDATAENVIRONMENTS__0" value: "defaulttest" {{- end }} - {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} - {{- if (.Values.migrations.seeding.testData.useDefault) }} - - name: "SEEDING__DATAPATHS__2" - value: "Seeder/Data/import/custom-test-data" - - name: "SEEDING__TESTDATAENVIRONMENTS__2" - value: "{{ .Values.migrations.seeding.testData.useOwnConfigMap.filename }}" - {{- else }} + {{- if and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename) }} + {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - name: "SEEDING__DATAPATHS__1" value: "Seeder/Data/import/custom-test-data" - name: "SEEDING__TESTDATAENVIRONMENTS__1" - value: "{{ .Values.migrations.seeding.testData.useOwnConfigMap.filename }}" + value: "{{ .Values.migrations.seeding.seedTestData.useOwnConfigMap.filename }}" + {{- else }} + - name: "SEEDING__DATAPATHS__0" + value: "Seeder/Data/import/custom-test-data" + - name: "SEEDING__TESTDATAENVIRONMENTS__0" + value: "{{ .Values.migrations.seeding.seedTestData.useOwnConfigMap.filename }}" {{- end }} {{- end }} - name: "SERILOG__MINIMUMLEVEL__Default" @@ -100,29 +96,29 @@ spec: protocol: TCP resources: {{- toYaml .Values.migrations.resources | nindent 10 }} - {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename)) }} + {{- if or (.Values.migrations.seeding.seedTestData.useDefault) (and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename)) }} volumeMounts: - {{- if (.Values.migrations.seeding.testData.useDefault) }} + {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - name: test-data-default mountPath: /migrations/Seeder/Data/import/default-test-data {{- end }} - {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} + {{- if and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename) }} - name: test-data-custom mountPath: /migrations/Seeder/Data/import/custom-test-data {{- end }} {{- end }} - {{- if or (.Values.migrations.seeding.testData.useDefault) (and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename)) }} + {{- if or (.Values.migrations.seeding.seedTestData.useDefault) (and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename)) }} volumes: - {{- if (.Values.migrations.seeding.testData.useDefault) }} + {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - name: test-data-default configMap: name: "{{ include "issuer.fullname" . }}-default-testdata" optional: true {{- end }} - {{- if and (.Values.migrations.seeding.testData.useOwnConfigMap.configMap) (.Values.migrations.seeding.testData.useOwnConfigMap.filename) }} + {{- if and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename) }} - name: test-data-custom configMap: - name: "{{ .Values.migrations.seeding.testData.useOwnConfigMap.configMap }}" + name: "{{ .Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap }}" optional: true {{- end }} {{- end }} diff --git a/charts/ssi-credential-issuer/values.yaml b/charts/ssi-credential-issuer/values.yaml index 59ca30e7..6e29bfe1 100644 --- a/charts/ssi-credential-issuer/values.yaml +++ b/charts/ssi-credential-issuer/values.yaml @@ -87,8 +87,8 @@ migrations: cpu: 45m memory: 200M seeding: - testDataEnvironments: "" - testData: + # -- Option to seed testdata + seedTestData: # -- If set to true the data configured in the config map 'configmap-seeding-testdata.yaml' will be taken to insert the default test data useDefault: false useOwnConfigMap: diff --git a/environments/helm-values/values-int.yaml b/environments/helm-values/values-int.yaml index bb7e39cb..0de7a1d2 100644 --- a/environments/helm-values/values-int.yaml +++ b/environments/helm-values/values-int.yaml @@ -58,7 +58,8 @@ service: migrations: logging: default: "Debug" - testData: + seeding: + seedTestData: useDefault: true processesworker: From 0da7b6dc9e073c89eaa9da257bfa7e92792945f4 Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Fri, 27 Sep 2024 17:15:39 +0200 Subject: [PATCH 10/12] fix: reserve DATAPATHS__0 to base seeding and fix invalid spec and format --- .../templates/configmap-seeding-testdata.yaml | 4 +- .../templates/job-issuer-migrations.yaml | 50 ++++++++++--------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml index a0a8c00d..151389eb 100644 --- a/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml +++ b/charts/ssi-credential-issuer/templates/configmap-seeding-testdata.yaml @@ -28,8 +28,8 @@ data: [ { "id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9", - "name": "None", - "shortname": "None" + "name": "None", + "shortname": "None" } ] verified_credential_external_type_detail_versions.defaulttest.json: |- diff --git a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml index b48d3484..d7750636 100644 --- a/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml +++ b/charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml @@ -67,22 +67,24 @@ spec: - name: "CONNECTIONSTRINGS__ISSUERDB" value: "Server={{ .Values.externalDatabase.host }};Database={{ .Values.externalDatabase.database }};Port={{ .Values.externalDatabase.port }};User Id={{ .Values.externalDatabase.username }};Password=$(ISSUER_PASSWORD);Ssl Mode={{ .Values.dbConnection.sslMode }};" {{- end }} - {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - name: "SEEDING__DATAPATHS__0" + value: "Seeder/Data" + {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} + - name: "SEEDING__DATAPATHS__1" value: "Seeder/Data/import/default-test-data" - - name: "SEEDING__TESTDATAENVIRONMENTS__0" + - name: "SEEDING__TESTDATAENVIRONMENTS__1" value: "defaulttest" {{- end }} {{- if and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename) }} {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - - name: "SEEDING__DATAPATHS__1" + - name: "SEEDING__DATAPATHS__2" value: "Seeder/Data/import/custom-test-data" - - name: "SEEDING__TESTDATAENVIRONMENTS__1" + - name: "SEEDING__TESTDATAENVIRONMENTS__2" value: "{{ .Values.migrations.seeding.seedTestData.useOwnConfigMap.filename }}" {{- else }} - - name: "SEEDING__DATAPATHS__0" + - name: "SEEDING__DATAPATHS__1" value: "Seeder/Data/import/custom-test-data" - - name: "SEEDING__TESTDATAENVIRONMENTS__0" + - name: "SEEDING__TESTDATAENVIRONMENTS__1" value: "{{ .Values.migrations.seeding.seedTestData.useOwnConfigMap.filename }}" {{- end }} {{- end }} @@ -99,26 +101,26 @@ spec: {{- if or (.Values.migrations.seeding.seedTestData.useDefault) (and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename)) }} volumeMounts: {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - - name: test-data-default - mountPath: /migrations/Seeder/Data/import/default-test-data + - name: test-data-default + mountPath: /migrations/Seeder/Data/import/default-test-data {{- end }} {{- if and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename) }} - - name: test-data-custom - mountPath: /migrations/Seeder/Data/import/custom-test-data + - name: test-data-custom + mountPath: /migrations/Seeder/Data/import/custom-test-data {{- end }} {{- end }} {{- if or (.Values.migrations.seeding.seedTestData.useDefault) (and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename)) }} - volumes: - {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} - - name: test-data-default - configMap: - name: "{{ include "issuer.fullname" . }}-default-testdata" - optional: true - {{- end }} - {{- if and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename) }} - - name: test-data-custom - configMap: - name: "{{ .Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap }}" - optional: true - {{- end }} - {{- end }} + volumes: + {{- if (.Values.migrations.seeding.seedTestData.useDefault) }} + - name: test-data-default + configMap: + name: "{{ include "issuer.fullname" . }}-default-testdata" + optional: true + {{- end }} + {{- if and (.Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap) (.Values.migrations.seeding.seedTestData.useOwnConfigMap.filename) }} + - name: test-data-custom + configMap: + name: "{{ .Values.migrations.seeding.seedTestData.useOwnConfigMap.configMap }}" + optional: true + {{- end }} + {{- end }} From 6a7b4e52bf37def8c9b450274fcca1fa1828d19a Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Fri, 27 Sep 2024 17:18:33 +0200 Subject: [PATCH 11/12] fix: don't seed test data on INT not required right now --- environments/helm-values/values-int.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/environments/helm-values/values-int.yaml b/environments/helm-values/values-int.yaml index 0de7a1d2..ef8b970c 100644 --- a/environments/helm-values/values-int.yaml +++ b/environments/helm-values/values-int.yaml @@ -58,9 +58,6 @@ service: migrations: logging: default: "Debug" - seeding: - seedTestData: - useDefault: true processesworker: logging: From 9cccea9b77daf27deb6ab344dc316c73b33c2535 Mon Sep 17 00:00:00 2001 From: Evelyn Gurschler Date: Fri, 27 Sep 2024 17:21:49 +0200 Subject: [PATCH 12/12] docs: update chart readme --- charts/ssi-credential-issuer/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/charts/ssi-credential-issuer/README.md b/charts/ssi-credential-issuer/README.md index 3273cb4c..59ddc4ee 100644 --- a/charts/ssi-credential-issuer/README.md +++ b/charts/ssi-credential-issuer/README.md @@ -76,10 +76,11 @@ dependencies: | migrations.image.pullSecrets | list | `[]` | | | migrations.imagePullPolicy | string | `"IfNotPresent"` | | | migrations.resources | object | `{"limits":{"cpu":"45m","memory":"200M"},"requests":{"cpu":"15m","memory":"200M"}}` | We recommend to review the default resource limits as this should a conscious choice. | -| migrations.seeding.seedTestDataEnvironments | string | `""` | | -| migrations.seeding.seedTestDataPaths | string | `"Seeder/Data"` | | +| migrations.seeding.seedTestData | object | `{"useDefault":false,"useOwnConfigMap":{"configMap":"","filename":""}}` | Option to seed testdata | +| migrations.seeding.seedTestData.useDefault | bool | `false` | If set to true the data configured in the config map 'configmap-seeding-testdata.yaml' will be taken to insert the default test data | +| migrations.seeding.seedTestData.useOwnConfigMap.configMap | string | `""` | ConfigMap containing json files for the tables to seed, e.g. use_cases.json, verified_credential_external_type_detail_versions.test.json, etc. | +| migrations.seeding.seedTestData.useOwnConfigMap.filename | string | `""` | Filename identifying the test data files e.g. for companies.test.json the value would be "test" | | migrations.logging.default | string | `"Information"` | | -| migrations.processIdentity.identityId | string | `"ac1cf001-7fbc-1f2f-817f-bce058020006"` | | | processesworker.name | string | `"processesworker"` | | | processesworker.image.name | string | `"docker.io/tractusx/ssi-credential-issuer-processes-worker"` | | | processesworker.image.tag | string | `""` | |