Skip to content

Commit

Permalink
remove unneeded configFileProvider as a test
Browse files Browse the repository at this point in the history
  • Loading branch information
zingmane committed Nov 30, 2023
1 parent c9bbfd9 commit bf4fc1f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 13 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ conf-*.json
!conf-example.json
!conf-test-example.json
!conf-github-ci.json
!conf-jenkins.json
uploads/
.vertx/
uploads*
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 25 additions & 0 deletions conf-jenkins.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
9 changes: 5 additions & 4 deletions docker-compose.run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf4fc1f

Please sign in to comment.