Skip to content

Commit

Permalink
WIP Newman Test
Browse files Browse the repository at this point in the history
  • Loading branch information
BarakStout committed Jul 6, 2020
1 parent 396deb1 commit cb72180
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 18 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
command: ["wait-for-it.sh", "zookeeper:2181", "--","start-kafka.sh"]
ports:
- "9092:9092"
logging:
driver: none
depends_on:
- zookeeper
environment:
Expand Down
12 changes: 9 additions & 3 deletions newman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

`kubectl config use-context <dev-context>`

```
```sh
helm install --namespace=newman \
--set env.KC_UN=$KC_UN \
--set env.KC_PW=$KC_PW \
Expand All @@ -34,7 +34,7 @@ helm install --namespace=newman \

### Newman as a docker container
* Run docker container
```
```sh
docker run -it -e KC_UN=$KC_UN -e KC_PW=$KC_PW -e KC_URL=$KC_URL -e KC_CLIENT_ID=$KC_CLIENT_ID \
-e HOST_FILING=$HOST_FILING -e HOST_ADMIN=$HOST_ADMIN -e HOST_PUBLIC=$HOST_PUBLIC -e HMDA_ENV=$HMDA_ENV \
-e MM_HOOK=$MM_HOOK hmda/newman-automation:latest /bin/sh
Expand Down Expand Up @@ -77,7 +77,13 @@ curl --location --request PUT $HOST_ADMIN'/institutions' \
}'
```
* Run newmantest
```
```sh
./scripts/newmanFiling.sh $KC_UN $KC_PW $KC_URL $KC_CLIENT_ID $HOST_FILING $HOST_ADMIN \
$HOST_PUBLIC $HMDA_ENV $MM_HOOK $NEWMAN_NOTIFY
```

### Running via Docker Compose
You can use `docker-compose` to run a single Newman filing test. If the `HOST_FILING` url is set to `http://localhost:8080`, the script will bypess getting an authentication token.
```sh
docker-compose up
```
39 changes: 29 additions & 10 deletions newman/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,37 @@ services:
container_name: hmda-newman-one
image: hmda/newman-automation:latest
environment:
- KC_UN=${KC_UN}
- KC_PW=${KC_PW}
- KC_URL=${KC_URL}
- KC_CLIENT_ID=${KC_CLIENT_ID}
- HOST_FILING=${HOST_FILING}
- HOST_ADMIN=${HOST_ADMIN}
- HOST_PUBLIC=${HOST_PUBLIC}
- HMDA_ENV=${HMDA_ENV}
- MM_HOOK=${MM_HOOK}
- YEAR=2019
HOST_FILING: hmda-platform_hmda-platform_1:8080
HOST_ADMIN: hmda-platform_hmda-platform_1:8081
HOST_PUBLIC: hmda-platform_hmda-platform_1:8082
NEWMAN_YEAR: 2019
command:
./scripts/run_one_newman.sh
volumes:
- ./src:/etc/newman
networks:
default:
external:
name: hmda-platform_default


# # - Newman
# hmda-newman:
# container_name: hmda-newman-single
# image: hmda/newman-automation:latest
# environment:
# # - KC_UN: ${KC_UN}
# # - KC_PW: ${KC_PW}
# # - KC_URL: ${KC_URL}
# # - KC_CLIENT_ID: ${KC_CLIENT_ID}

# # - HMDA_ENV: ${HMDA_ENV}
# # - MM_HOOK: ${MM_HOOK}
# # - YEAR: ${NEWMAN_YEAR}
# depends_on:
# - hmda-platform
# command:
# - "echo 'HELLO' "
# volumes:
# - ./wait-for-it.sh:/usr/bin/wait-for-it.sh
# - ./src:/etc/newman
26 changes: 21 additions & 5 deletions newman/scripts/run_one_newman.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
#!/bin/bash
#
# Run ./run_one_newman.sh

echo env
echo $HOST_FILING

# if [ $HOST_FILING = 'hmda-platform:8080' ]; then
# echo 'localhost config detected'
# else
# echo 'running against server'
# authToken=$(./scripts/authTokenGen.sh $KC_UN $KC_PW $KC_URL $KC_CLIENT_ID)
# fi

CONFIG_PATH="tests/hmda-filing/configs/$NEWMAN_YEAR/test_no_m_no_q/hmda-filing-api-config.json"

# curl --location --request PUT $HOST_ADMIN'/institutions' --header 'Content-Type: application/json' --header "Authorization: Bearer $authToken" --data-raw '{ "activityYear": 2019, "lei": "NEWMANLEITEST1234678", "agency": 9, "institutionType": -1, "institutionId2017": "", "taxId": "84-7652134", "rssd": -1, "emailDomains": [ "newmantest.com" ], "respondent": { "name": "Newman Bank", "state": "", "city": "" }, "parent": { "idRssd": -1, "name": "" }, "assets": 5, "otherLenderCode": -1, "topHolder": { "idRssd": -1, "name": "" }, "hmdaFiler": true, "quarterlyFiler": true, "quarterlyFilerHasFiledQ1": false, "quarterlyFilerHasFiledQ2": false, "quarterlyFilerHasFiledQ3": false }'
curl --location --request PUT $HOST_ADMIN'/institutions' --header 'Content-Type: application/json' --data-raw '{ "activityYear": 2019, "lei": "NEWMANLEITEST1234678", "agency": 9, "institutionType": -1, "institutionId2017": "", "taxId": "84-7652134", "rssd": -1, "emailDomains": [ "newmantest.com" ], "respondent": { "name": "Newman Bank", "state": "", "city": "" }, "parent": { "idRssd": -1, "name": "" }, "assets": 5, "otherLenderCode": -1, "topHolder": { "idRssd": -1, "name": "" }, "hmdaFiler": true, "quarterlyFiler": true, "quarterlyFilerHasFiledQ1": false, "quarterlyFilerHasFiledQ2": false, "quarterlyFilerHasFiledQ3": false }'

authToken=$(./scripts/authTokenGen.sh $KC_UN $KC_PW $KC_URL $KC_CLIENT_ID) && \
newman run tests/hmda-filing/tests/test_no_m_no_q/hmda-filing-api-test.json -d \
tests/hmda-filing/configs/$YEAR/test_no_m_no_q/hmda-filing-api-config.json \
$CONFIG_PATH \
--env-var host_filing=$HOST_FILING \
--env-var host_admin_api=$HOST_ADMIN \
--env-var host_public=$HOST_PUBLIC \
--env-var authToken="Bearer $authToken" \
--bail
--env-var host_public=$HOST_PUBLIC

echo "done"

0 comments on commit cb72180

Please sign in to comment.