-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run the API tests against a real loan storage module
- Loading branch information
1 parent
5d872af
commit cf5b287
Showing
10 changed files
with
156 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"id": "loan-storage" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
tenant_id=${1:-demo_tenant} | ||
|
||
tenant_json=$(cat ./okapi-setup/tenant.json) | ||
|
||
tenant_json="${tenant_json/tenantidhere/$tenant_id}" | ||
|
||
curl -w '\n' -X POST -D - \ | ||
-H "Content-type: application/json" \ | ||
-d "${tenant_json}" \ | ||
http://localhost:9130/_/proxy/tenants |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
tenant_id=${1:-demo_tenant} | ||
|
||
curl -X DELETE -D - -w '\n' http://localhost:9130/_/proxy/tenants/${tenant_id} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"id": "tenantidhere", | ||
"name": "A Library", | ||
"description": "A library" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
okapi_proxy_address="http://localhost:9130" | ||
tenant_id="test_tenant" | ||
|
||
echo "Check if Okapi is contactable" | ||
curl -w '\n' -X GET -D - \ | ||
"${okapi_proxy_address}/_/env" || exit 1 | ||
|
||
echo "Create ${tenant_id} tenant" | ||
./create-tenant.sh ${tenant_id} | ||
|
||
echo "Activate loan storage for ${tenant_id}" | ||
activate_json=$(cat ./activate-loan-storage.json) | ||
|
||
curl -w '\n' -X POST -D - \ | ||
-H "Content-type: application/json" \ | ||
-d "${activate_json}" \ | ||
"${okapi_proxy_address}/_/proxy/tenants/${tenant_id}/modules" | ||
|
||
echo "Run API tests" | ||
gradle clean testApiViaOkapi | ||
|
||
test_results=$? | ||
|
||
echo "Deactivate loan storage for ${tenant_id}" | ||
curl -X DELETE -D - -w '\n' "${okapi_proxy_address}/_/proxy/tenants/${tenant_id}/modules/loan-storage" | ||
|
||
echo "Deleting ${tenant_id}" | ||
./delete-tenant.sh ${tenant_id} | ||
|
||
if [ $test_results != 0 ]; then | ||
echo '--------------------------------------' | ||
echo 'BUILD FAILED' | ||
echo '--------------------------------------' | ||
exit 1; | ||
else | ||
echo '--------------------------------------' | ||
echo 'BUILD SUCCEEDED' | ||
echo '--------------------------------------' | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters