From 5bb7891623c83558654db65fba2bdff0ea18e4f4 Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 09:24:41 +0200 Subject: [PATCH 1/8] provider integration test --- .github/workflows/main.yaml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6cbd763..e50dc1f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -28,6 +28,26 @@ jobs: - name: Build + verify run: mvn -B verify + integration-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Run Integration tests + run: mvn integration-test + docker: needs: - test From 19eb87fb6559908f2915cf0f248e61bc565bfb59 Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 11:06:12 +0200 Subject: [PATCH 2/8] debug --- .github/workflows/main.yaml | 15 +++++++ Dockerfile | 2 +- docker-compose.yml | 16 ++++++++ postman/postman_collection.json | 71 +++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml create mode 100644 postman/postman_collection.json diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e50dc1f..39d0d87 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -83,3 +83,18 @@ jobs: tags: | ${{ env.DOCKER_NAME }}:${{ env.COMMIT_SHA }} push: ${{ env.PUSH_DOCKER_IMAGE }} + + postman-test: + needs: + - docker + name: postman test + runs-on: ubuntu-latest + container: + image: ${{ env.DOCKER_NAME }}:${{ env.COMMIT_SHA }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 14 + - run: npm install newman -g + - run: newman run postman/postman_collection.json diff --git a/Dockerfile b/Dockerfile index 324ee4d..1634a0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,4 @@ COPY launch.sh /app/ EXPOSE 8080 WORKDIR /app -CMD ["bash", "launch.sh"] +CMD ["sh", "launch.sh"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3fdaa9d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.7" +services: + application: + build: . + ports: + - 8080:8080 + + postman_test: + image: postman/newman + command: + run postman_collection.json + -r html,cli + --reporter-html-export reports/Postman.html + --reporter-html-template reports/templates/customTemplate.hbs + volumes: + - ./postman:/etc/newman \ No newline at end of file diff --git a/postman/postman_collection.json b/postman/postman_collection.json new file mode 100644 index 0000000..8288841 --- /dev/null +++ b/postman/postman_collection.json @@ -0,0 +1,71 @@ +{ + "info": { + "_postman_id": "ed004fd8-8f9e-4a01-b1a2-2bc159c5dcb8", + "name": "Simple Provider", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "Successfull call (200)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Status code is 200', () => {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "localhost:8080/items", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "items" + ] + } + }, + "response": [] + }, + { + "name": "Not successfull call (404)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test('Status code is 404', () => {", + " pm.response.to.have.status(404);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "localhost:8080/unknown", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "unknown" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file From f1f317fa4c5e29fcfd53fcde87fabf38f892d529 Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 11:07:30 +0200 Subject: [PATCH 3/8] debug --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 39d0d87..88595cc 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -6,6 +6,7 @@ env: GROUP: senacor COMMIT_SHA: ${{ github.sha }} REPO: simple-provider + DOCKER_NAME: ghcr.io/${{ github.repository }} jobs: test: @@ -54,7 +55,6 @@ jobs: runs-on: ubuntu-latest env: PUSH_DOCKER_IMAGE: true - DOCKER_NAME: ghcr.io/${{ github.repository }} DOCKER_REGISTRY: ghcr.io steps: - uses: actions/checkout@v2 From 686d4272c0962be914b73efc058f5cbf34f5a0aa Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 11:15:35 +0200 Subject: [PATCH 4/8] debug --- .github/workflows/main.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 88595cc..b1bee49 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -89,8 +89,11 @@ jobs: - docker name: postman test runs-on: ubuntu-latest - container: - image: ${{ env.DOCKER_NAME }}:${{ env.COMMIT_SHA }} + services: + test-service: + image: ghcr.io/senacor/simple-provider:858837023ea0a0a8be19d40712392e9ef4b91c62 + ports: + - 8080:8080 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 From 555c5b69a10b7f940723c867c4cbca4a29b27fc2 Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 11:19:55 +0200 Subject: [PATCH 5/8] debug --- .github/workflows/main.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b1bee49..7db7685 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -7,6 +7,7 @@ env: COMMIT_SHA: ${{ github.sha }} REPO: simple-provider DOCKER_NAME: ghcr.io/${{ github.repository }} + DOCKER_IMAGE_NAME: ${{ env.DOCKER_NAME }}:${{ env.COMMIT_SHA }} jobs: test: @@ -50,8 +51,10 @@ jobs: run: mvn integration-test docker: - needs: - - test + # enable this again + # needs: + # - test + # - integration-test runs-on: ubuntu-latest env: PUSH_DOCKER_IMAGE: true @@ -81,7 +84,7 @@ jobs: with: context: . tags: | - ${{ env.DOCKER_NAME }}:${{ env.COMMIT_SHA }} + ${{ env.DOCKER_IMAGE_NAME }} push: ${{ env.PUSH_DOCKER_IMAGE }} postman-test: @@ -91,7 +94,7 @@ jobs: runs-on: ubuntu-latest services: test-service: - image: ghcr.io/senacor/simple-provider:858837023ea0a0a8be19d40712392e9ef4b91c62 + image: ${{ env.DOCKER_IMAGE_NAME }} ports: - 8080:8080 steps: From 7c0ecc0cd6f97c622eb950c4f151d45778fa7ed6 Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 11:35:06 +0200 Subject: [PATCH 6/8] debug --- .github/workflows/main.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7db7685..e97341e 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -4,10 +4,7 @@ on: push env: GROUP: senacor - COMMIT_SHA: ${{ github.sha }} REPO: simple-provider - DOCKER_NAME: ghcr.io/${{ github.repository }} - DOCKER_IMAGE_NAME: ${{ env.DOCKER_NAME }}:${{ env.COMMIT_SHA }} jobs: test: @@ -84,7 +81,7 @@ jobs: with: context: . tags: | - ${{ env.DOCKER_IMAGE_NAME }} + ghcr.io/${{ github.repository }}:${{ github.sha }} push: ${{ env.PUSH_DOCKER_IMAGE }} postman-test: @@ -94,7 +91,7 @@ jobs: runs-on: ubuntu-latest services: test-service: - image: ${{ env.DOCKER_IMAGE_NAME }} + image: ghcr.io/${{ github.repository }}:${{ github.sha }} ports: - 8080:8080 steps: From 090ac8f69dd1918d549516cbbc0f3740ed7765b1 Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 11:36:57 +0200 Subject: [PATCH 7/8] debug --- postman/postman_collection.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postman/postman_collection.json b/postman/postman_collection.json index 8288841..925e6d2 100644 --- a/postman/postman_collection.json +++ b/postman/postman_collection.json @@ -13,7 +13,7 @@ "script": { "exec": [ "pm.test('Status code is 200', () => {", - " pm.response.to.have.status(200);", + " pm.response.to.have.status(204);", "});" ], "type": "text/javascript" From 3e861daa412a5c0d73f408fd32d32f55ee59ca51 Mon Sep 17 00:00:00 2001 From: Christoph Laufs Date: Mon, 31 May 2021 11:39:41 +0200 Subject: [PATCH 8/8] debug --- .github/workflows/main.yaml | 7 +++---- docker-compose.yml | 12 +----------- postman/postman_collection.json | 2 +- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index e97341e..65f2425 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -48,10 +48,9 @@ jobs: run: mvn integration-test docker: - # enable this again - # needs: - # - test - # - integration-test + needs: + - test + - integration-test runs-on: ubuntu-latest env: PUSH_DOCKER_IMAGE: true diff --git a/docker-compose.yml b/docker-compose.yml index 3fdaa9d..9dad940 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,14 +3,4 @@ services: application: build: . ports: - - 8080:8080 - - postman_test: - image: postman/newman - command: - run postman_collection.json - -r html,cli - --reporter-html-export reports/Postman.html - --reporter-html-template reports/templates/customTemplate.hbs - volumes: - - ./postman:/etc/newman \ No newline at end of file + - 8080:8080 \ No newline at end of file diff --git a/postman/postman_collection.json b/postman/postman_collection.json index 925e6d2..8288841 100644 --- a/postman/postman_collection.json +++ b/postman/postman_collection.json @@ -13,7 +13,7 @@ "script": { "exec": [ "pm.test('Status code is 200', () => {", - " pm.response.to.have.status(204);", + " pm.response.to.have.status(200);", "});" ], "type": "text/javascript"