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

Provider integration test #6

Merged
merged 8 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: push

env:
GROUP: senacor
COMMIT_SHA: ${{ github.sha }}
REPO: simple-provider

jobs:
Expand All @@ -28,13 +27,33 @@ 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
- integration-test
runs-on: ubuntu-latest
env:
PUSH_DOCKER_IMAGE: true
DOCKER_NAME: ghcr.io/${{ github.repository }}
DOCKER_REGISTRY: ghcr.io
steps:
- uses: actions/checkout@v2
Expand All @@ -61,5 +80,23 @@ jobs:
with:
context: .
tags: |
${{ env.DOCKER_NAME }}:${{ env.COMMIT_SHA }}
ghcr.io/${{ github.repository }}:${{ github.sha }}
push: ${{ env.PUSH_DOCKER_IMAGE }}

postman-test:
needs:
- docker
name: postman test
runs-on: ubuntu-latest
services:
test-service:
image: ghcr.io/${{ github.repository }}:${{ github.sha }}
ChristophLau marked this conversation as resolved.
Show resolved Hide resolved
ports:
- 8080:8080
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ COPY launch.sh /app/
EXPOSE 8080

WORKDIR /app
CMD ["bash", "launch.sh"]
CMD ["sh", "launch.sh"]
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.7"
services:
application:
build: .
ports:
- 8080:8080
71 changes: 71 additions & 0 deletions postman/postman_collection.json
Original file line number Diff line number Diff line change
@@ -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": []
}
]
}