Skip to content

Commit

Permalink
feat: enable verbose output and update checks for empty response body
Browse files Browse the repository at this point in the history
  • Loading branch information
nikschul committed Oct 9, 2024
1 parent 934e90a commit 7291102
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_controlplane_management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ jobs:
- name: "Run Newman"
working-directory: ./deployment/postman
run: |-
newman run "MVD.postman_collection.json" -e "MVD K8S.postman_environment.json" --folder "ControlPlane Management" --delay-request 5000
newman run "MVD.postman_collection.json" -e "MVD K8S.postman_environment.json" --folder "ControlPlane Management" --delay-request 5000 --verbose
33 changes: 7 additions & 26 deletions deployment/postman/MVD.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,11 @@
"script": {
"exec": [
"// get the policy id of \"asset-1\" and save it as an environment variable",
"const dcat_datasets = pm.response.json()[0][\"dcat:dataset\"][1][\"dcat:dataset\"]",
"const asset_1 = dcat_datasets.find((asset) => asset[\"@id\"] == \"asset-1\")",
"pm.environment.set(\"POLICY_ID_ASSET_1\", asset_1[\"odrl:hasPolicy\"][\"@id\"]);",
"if(pm.response.code < 300 && pm.response.code >= 200 && pm.response.json().length > 0){",
" const dcat_datasets = pm.response.json()[0][\"dcat:dataset\"][1][\"dcat:dataset\"]",
" const asset_1 = dcat_datasets.find((asset) => asset[\"@id\"] == \"asset-1\")",
" pm.environment.set(\"POLICY_ID_ASSET_1\", asset_1[\"odrl:hasPolicy\"][\"@id\"]);",
"}",
"",
""
],
Expand Down Expand Up @@ -560,7 +562,7 @@
"script": {
"exec": [
"// get the contact agreement id and save it as an environment variable",
"if(pm.response.code < 300 && pm.response.code >= 200){",
"if(pm.response.code < 300 && pm.response.code >= 200 && pm.response.json().length > 0){",
" //using the first contract agreement id found",
" const contractAgreementId = pm.response.json()[0][\"contractAgreementId\"];",
" pm.environment.set(\"CONTRACT_AGREEMENT_ID\", contractAgreementId);",
Expand Down Expand Up @@ -714,13 +716,8 @@
"listen": "test",
"script": {
"exec": [
"response = pm.response.json();",
"pm.test('Body is not empty', () =>{",
" pm.expect(response.length).to.be.greaterThan(0);",
"})",
"",
"// get the transfer process id of \"asset-1\" and save it as an environment variable if the response body is not empty",
"if(pm.response.code < 300 && pm.response.code >= 200 && response.length > 0){",
"if(pm.response.code < 300 && pm.response.code >= 200 && pm.response.json().length > 0){",
" const transferProcessId = pm.response.json()[0][\"transferProcessId\"];",
" pm.environment.set(\"TRANSFER_PROCESS_ID\", transferProcessId);",
"}"
Expand All @@ -729,22 +726,6 @@
"packages": {}
}
},
{
"listen": "test",
"script": {
"exec": [
"// get the transfer process id of \"asset-1\" and save it as an environment variable",
"if(pm.response.code < 300 && pm.response.code >= 200){",
" const transferProcessId = pm.response.json()[0][\"transferProcessId\"];",
" pm.environment.set(\"TRANSFER_PROCESS_ID\", transferProcessId);",
"}",
"",
""
],
"type": "text/javascript",
"packages": {}
}
},
{
"listen": "test",
"script": {
Expand Down

0 comments on commit 7291102

Please sign in to comment.