diff --git a/.dockerignore b/.dockerignore index 7d0ef41c..247dac62 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,3 +10,4 @@ # files for testing # !conf-test.json # does not exist, is provided by Jenkins config file provider !role-permissions-test.json +!conf-jenkins.json diff --git a/.gitignore b/.gitignore index 4474bbf0..db49acdd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ conf-*.json !conf-example.json !conf-test-example.json !conf-github-ci.json +!conf-jenkins.json uploads/ .vertx/ uploads* diff --git a/Dockerfile b/Dockerfile index 0abbcb19..b2cb553f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,8 @@ WORKDIR $APP_HOME COPY --chown=gradle:gradle . $APP_HOME # RUN ls -rtla $APP_HOME RUN gradle -v \ - && gradle testClasses assemble + && gradle testClasses assemble \ + && mv conf-jenkins.json conf-test.json FROM gradle:7.4.1-jdk17 as tester WORKDIR $APP_HOME diff --git a/Jenkinsfile b/Jenkinsfile index 912d5961..4e42643f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,14 +57,14 @@ pipeline { steps { script { try { - configFileProvider([configFile(fileId: 'grud-backend-build', targetLocation: 'conf-test.json')]) { - sh """ - TEST_IMAGE=${IMAGE_NAME}-builder \ - CLEAN_GIT_BRANCH=${CLEAN_GIT_BRANCH}-build-${BUILD_NUMBER} \ - docker-compose -f ./docker-compose.run-tests.yml up \ - --abort-on-container-exit --exit-code-from grud-backend - """ - } + // configFileProvider([configFile(fileId: 'grud-backend-build', targetLocation: 'conf-test.json')]) { + sh """ + TEST_IMAGE=${IMAGE_NAME}-builder \ + CLEAN_GIT_BRANCH=${CLEAN_GIT_BRANCH}-build-${BUILD_NUMBER} \ + docker-compose -f ./docker-compose.run-tests.yml up \ + --abort-on-container-exit --exit-code-from grud-backend + """ + // } } finally { sh "docker cp grud-backend-branch-${CLEAN_GIT_BRANCH}-build-${BUILD_NUMBER}:/usr/src/app/build ./build/" junit './build/test-results/test/TEST-*.xml' //make the junit test results available in any case (success & failure) diff --git a/conf-jenkins.json b/conf-jenkins.json new file mode 100644 index 00000000..5d13392c --- /dev/null +++ b/conf-jenkins.json @@ -0,0 +1,25 @@ +{ + "host": "127.0.0.1", + "uploadsDirectory": "uploads/", + "workingDirectory": "./", + "rolePermissionsPath": "./role-permissions-test.json", + "database": { + "host": "postgres", + "port": 5432, + "username": "testing", + "database": "testing", + "password": "testing" + }, + "auth": { + "realm": "keycloak-realm-permission-test", + "realm-public-key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuuFUzR6uqEU80fNWA88FInoGtUgeQ7JEm1yzh8ii6zP0u+FzezLveJAhTO63YtbYddiyZZ+oQcA4ONbyBQLTrtC9X9Nbi/dhaygWFkZYLoNhGbOASrOCOIAStsU2pRfcOt/7WTxV6G/RaugO3/fArfvs/8SZ54qS1g2fIHz4jhKepQj/SRxqvhTLSY6cQHEqiToxAVjONV1toLaHWDbVSA1mVZ9hbhdhE07DZaT/YS4EgjgrLTxQohqy7R9pqk6yJ6TsOcbQfbXVZpKv5BoOV+EtDjlvHxAyHH0Dg2pCK8HSmyEqKaNfG/R/HfYb8JC4tIJunEEhm/1fEt1EkxIZqQIDAQAB", + "bearer-only": true, + "auth-server-url": "http://localhost:9999/auth", + "ssl-required": "external", + "resource": "grud-backend", + "verify-token-audience": true, + "use-resource-role-mappings": true, + "confidential-port": 0, + "issuer": "campudus-test" + } +} diff --git a/docker-compose.run-tests.yml b/docker-compose.run-tests.yml index e1ca8571..a15dd551 100644 --- a/docker-compose.run-tests.yml +++ b/docker-compose.run-tests.yml @@ -7,12 +7,13 @@ services: container_name: grud-backend-branch-${CLEAN_GIT_BRANCH} depends_on: - postgres - volumes: - - ./conf-test.json:/usr/src/app/conf-test.json # as provided by Jenkins config file provider + # volumes: + # - ./conf-test.json:/usr/src/app/conf-test.json # as provided by Jenkins config file provider # - ./conf-jenkins.json:/usr/src/app/conf-test.json # command: ["ls", "-rtla"] - command: ["gradle", "test", "--tests", "*changeSimpleValue_booleanInitHistoryWithSameValue*", "--info" ] - # command: ["gradle", "test" ] + # command: ["gradle", "test", "--tests", "*changeSimpleValue_booleanInitHistoryWithSameValue*", "--info" ] + # command: ["gradle", "test", "--tests", "*CreateHistoryChangeDetectionTest*" ] + command: ["gradle", "test" ] postgres: image: postgres:16.1-alpine