Skip to content
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

feat(testdata): enable seeding via configMap, remove consortia files #241

Merged
merged 12 commits into from
Sep 27, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{- /*
* 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
*/}}

{{- if .Values.migrations.seeding.testData.useDefault -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "issuer.fullname" . }}-default-testdata
namespace: {{ .Release.Namespace }}
data:
use_cases.defaulttest.json: |-
[
{
"id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9",
"name": "None",
"shortname": "None"
}
]
verified_credential_external_type_detail_versions.defaulttest.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.defaulttest.json: |-
[
{
"verified_credential_external_type_id": 11,
"verified_credential_type_id": 11
}
]
verified_credential_type_assigned_use_cases.defaulttest.json: |-
[
{
"verified_credential_type_id": 11,
"use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd9"
}
]
{{- end -}}
49 changes: 47 additions & 2 deletions charts/ssi-credential-issuer/templates/job-issuer-migrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,59 @@ spec:
- name: "SEEDING__TESTDATAENVIRONMENTS__0"
value: "{{ .Values.migrations.seeding.testDataEnvironments }}"
evegufy marked this conversation as resolved.
Show resolved Hide resolved
- name: "SEEDING__DATAPATHS__0"
value: "{{ .Values.migrations.seeding.testDataPaths }}"
value: "Seeder/Data"
{{- if (.Values.migrations.seeding.testData.useDefault) }}
- name: "SEEDING__DATAPATHS__1"
value: "Seeder/Data/import/default-test-data"
- name: "SEEDING__TESTDATAENVIRONMENTS__1"
value: "defaulttest"
{{- end }}
{{- if and (.Values.migrations.seeding.testData.configMap) (.Values.migrations.seeding.testData.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 }}"
{{ else }}
- name: "SEEDING__DATAPATHS__1"
value: "Seeder/Data/import/custom-test-data"
- name: "SEEDING__TESTDATAENVIRONMENTS__1"
value: "{{ .Values.migrations.seeding.testData.filename }}"
{{- end }}
{{- 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 }}
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)) }}
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) }}
- 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)) }}
volumes:
{{- if (.Values.migrations.seeding.testData.useDefault) }}
- name: test-data-default
configMap:
name: "{{ include "issuer.fullname" . }}-default-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 }}
10 changes: 7 additions & 3 deletions charts/ssi-credential-issuer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,15 @@ migrations:
memory: 200M
seeding:
testDataEnvironments: ""
evegufy marked this conversation as resolved.
Show resolved Hide resolved
testDataPaths: "Seeder/Data"
testData:
evegufy marked this conversation as resolved.
Show resolved Hide resolved
# -- 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: ""
logging:
default: "Information"
processIdentity:
identityId: ac1cf001-7fbc-1f2f-817f-bce058020006

processesworker:
name: "processesworker"
Expand Down
2 changes: 2 additions & 0 deletions environments/helm-values/values-int.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ service:
migrations:
logging:
default: "Debug"
testData:
useDefault: true

processesworker:
logging:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down