Skip to content

Commit

Permalink
Provider integration test (#6)
Browse files Browse the repository at this point in the history
* provider integration test
Co-authored-by: Christoph Laufs <[email protected]>
  • Loading branch information
ChristophLau authored May 31, 2021
1 parent 180d77b commit fbb66d6
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 3 deletions.
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 }}
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
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": []
}
]
}

0 comments on commit fbb66d6

Please sign in to comment.