-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
story: 117304 implement openklant 2.0 (#302)
* wip * wip * wip * wip * improve gradle setup so that docker compose can be used for integration testing on macOS * * make filtering easier to apply to OpenKlant requests * fix integration tests not running on check/build * remove unnecessary Create* dto's * * separate contactgegevens api from klantinteracties api in OpenKlant Module * * more gradle test fixes * expand filtering with page * * added partijen path test * refactored some functions and class names * * wip PartijMutation * * add initial PartijMutation test * * add assertions to Partij Mutation test * * implement updatePartij mutation * * run ktlint * * refactor some tests * introduce initial DigitaleAdres related entities and queries * * change default loglevels for app to info * disable sql logging for app * fix DigitaleAdresType serialization * add authentication requirement to all openklant queries and mutations * add delete DigitaleAdres mutation * * revert splitting autoconfiguration * change base integration test image * * add missing queries * * changed return type of deleteUserDigitaleAdres mutation * integration tests for DigitaleAdres * fixed integration test ordering in test classe where it matters
- Loading branch information
1 parent
beb75c1
commit b9d4773
Showing
67 changed files
with
4,279 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
echo ">>>> Starting Open Klant data import script <<<<" | ||
|
||
sh /docker-entrypoint-initdb.d/sql/fill-data-on-startup.sh & |
1 change: 1 addition & 0 deletions
1
docker-resources/imports/openklant-2/database/sql/1-add-authtoken.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
INSERT INTO public.token_tokenauth (id, token, contact_person, email, organization, last_modified, created, application, administration) VALUES (1, 'ac045222c9e7cde8120b48735560f9b920bb58cd', 'Admin', '[email protected]', '', '2024-09-06 07:26:53.703312 +00:00', '2024-09-06 07:26:53.703384 +00:00', '', ''); |
20 changes: 20 additions & 0 deletions
20
docker-resources/imports/openklant-2/database/sql/fill-data-on-startup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
echo ">>>> Waiting until Open Klant has initialized the database <<<<" | ||
while true | ||
do | ||
initiated=$(psql -U openklant -d openklant -t -A -c "SELECT EXISTS (SELECT table_name FROM information_schema.tables WHERE table_name = 'accounts_user');") | ||
if [ "t" = "${initiated}" ] | ||
then | ||
echo "Running database setup scripts" | ||
for file in /docker-entrypoint-initdb.d/sql/*.sql | ||
do | ||
echo "Running $file" | ||
psql -U openklant -d openklant -f $file | ||
done | ||
break | ||
else | ||
echo "Open Klanten is not initiated yet" | ||
sleep 5 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Apply database migrations | ||
>&2 echo "Apply database migrations" | ||
python src/manage.py migrate | ||
|
||
exists=$(echo "from django.contrib.auth import get_user_model; User = get_user_model(); print(User.objects.filter(username='admin').exists())" | python src/manage.py shell) | ||
if [ "False" = "${exists}" ] | ||
then | ||
echo "Creating user 'admin'" | ||
python src/manage.py createsuperuser --username=admin [email protected] --noinput | ||
else | ||
echo "User 'admin' already exists" | ||
fi | ||
echo "Setting 'admin' password." | ||
echo "from django.contrib.auth import get_user_model; User = get_user_model(); user = User.objects.get(username='admin'); user.set_password('admin'); user.save()" | python src/manage.py shell | ||
echo "Loading fixtures" | ||
python src/manage.py loaddata klantinteracties contactgegevens | ||
echo "Finished setup" | ||
|
||
sh /start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2015-2024 Ritense BV, the Netherlands. | ||
* | ||
* Licensed under EUPL, Version 1.2 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 | ||
* | ||
* 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. | ||
*/ | ||
|
||
tasks.register<Test>("integrationTest") { | ||
group = "verification" | ||
description = | ||
""" | ||
Composes docker containers and runs Tests tagged with "integration". | ||
NB! Project root must contain a docker compose file with the following name: docker-compose-override.yml | ||
""".trimIndent() | ||
useJUnitPlatform { | ||
includeTags("integration") | ||
} | ||
} | ||
|
||
tasks.named<Test>("test") { | ||
useJUnitPlatform { | ||
excludeTags("integration") | ||
} | ||
} | ||
|
||
tasks.named("check") { | ||
dependsOn(tasks.getByName("integrationTest")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,4 +56,5 @@ include( | |
"zgw:taak", | ||
"zgw:zaken-api", | ||
"zgw:objectenapi", | ||
"zgw:openklant", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
||
/* | ||
* Copyright (c) 2024 Ritense BV, the Netherlands. | ||
* | ||
* Licensed under EUPL, Version 1.2 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 | ||
* | ||
* 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. | ||
*/ | ||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
val isLib = true | ||
|
||
dockerCompose { | ||
setProjectName("$name-test") | ||
isRequiredBy(tasks.getByName("integrationTest")) | ||
useComposeFiles.addAll("../../docker-resources/docker-compose-base-test.yml", "docker-compose-override.yml") | ||
} | ||
|
||
dependencies { | ||
api(project(":graphql")) | ||
api(project(":portal-authentication")) | ||
api(project(":zgw:common-ground-authentication")) | ||
|
||
testImplementation(project(":zgw:common-ground-authentication-test")) | ||
testImplementation(TestDependencies.postgresql) | ||
testImplementation("org.springframework.boot", "spring-boot-starter-test") | ||
testImplementation("org.springframework.security", "spring-security-test") | ||
testImplementation(TestDependencies.kotlinCoroutines) | ||
testImplementation(TestDependencies.mockitoKotlin) | ||
testImplementation(TestDependencies.okHttpMockWebserver) | ||
testImplementation(TestDependencies.okHttp) | ||
} | ||
|
||
val jar: Jar by tasks | ||
val bootJar: BootJar by tasks | ||
bootJar.enabled = false | ||
jar.enabled = true | ||
|
||
apply(from = "gradle/publishing.gradle.kts") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
services: | ||
|
||
# openklant 2 | ||
openklant-2: | ||
image: maykinmedia/open-klant:2.1.0 | ||
container_name: openklant-2-test | ||
ports: | ||
- "9007:8000" | ||
depends_on: | ||
- openklant-2-db | ||
- redis | ||
environment: | ||
- DJANGO_SETTINGS_MODULE=openklant.conf.docker | ||
- IS_HTTPS=no | ||
- DB_NAME=openklant | ||
- DB_USER=openklant | ||
- DB_PASSWORD=openklant | ||
- DB_HOST=openklant-2-db | ||
- ALLOWED_HOSTS=* | ||
- CACHE_DEFAULT=redis-test:6379/0 | ||
- CACHE_AXES=redis-test:6379/0 | ||
- SUBPATH=${SUBPATH:-/} | ||
- SECRET_KEY=${SECRET_KEY:-django-insecure-f8s@b*ds4t84-q_2#c0j0506@!l2q6r5_pq5e!vm^_9c*#^66b} | ||
- CELERY_BROKER_URL=redis://redis-test:6379/0 | ||
- CELERY_RESULT_BACKEND=redis://redis-test:6379/0 | ||
- DISABLE_2FA=true | ||
volumes: | ||
- ./imports/openklant-2/init:/app/init | ||
command: sh /app/init/init.sh | ||
|
||
openklant-2-db: | ||
image: postgres:15 | ||
container_name: openklant-2-db-test | ||
environment: | ||
- POSTGRES_USER=openklant | ||
- POSTGRES_PASSWORD=openklant | ||
- POSTGRES_DB=openklant | ||
volumes: | ||
- ./imports/openklant-2/database:/docker-entrypoint-initdb.d/ | ||
|
||
redis: | ||
image: redis:6.2.6 | ||
container_name: redis-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Copyright (c) 2024 Ritense BV, the Netherlands. | ||
# | ||
# Licensed under EUPL, Version 1.2 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 | ||
# | ||
# 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. | ||
# | ||
|
||
isLib = true |
Oops, something went wrong.