Skip to content

Commit

Permalink
Merge pull request eclipse-tractusx#548 from catenax-ng/feature/TRI-1…
Browse files Browse the repository at this point in the history
…523_adjust-tavern-tests-for-ESS

TRI-1523: Adjusted and tavern tests for ESS-investigation use cases
  • Loading branch information
ds-alexander-bulgakov authored Sep 27, 2023
2 parents b64020e + b0595e3 commit 036edbc
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 104 deletions.
263 changes: 165 additions & 98 deletions local/testing/api-tests/irs-api-tests.tavern.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_name: Make sure investigation job with invalid request is handled correctly with MOCK
test_name: Make sure investigation job with invalid request is handled correctly

strict:
- headers:off
Expand All @@ -7,14 +7,13 @@ strict:
stages:
- name: register a BPN investigation with invalid request
request:
url: "{tavern.env_vars.IRS_HOST}/ess/bpn/investigations"
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
json:
globalAssetId111: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7
# key:
# globalAssetId111: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7
# bpn: BPNL00000003CRHK
incidentBpns11:
- BPNL00000003B6LU
key:
globalAssetId111: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7
bpn111: BPNL00000003CRHK
incidentBPNSs111:
- BPNS00000003B6LU
method: POST
headers:
content-type: application/json
Expand All @@ -34,7 +33,7 @@ stages:
---


test_name: Make sure investigation job with valid globalAssetId and BPN is processed correctly with MOCK
test_name: Make sure investigation job with valid globalAssetId and BPN is processed correctly

strict:
- headers:off
Expand All @@ -45,14 +44,14 @@ stages:
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
json:
# key:
# globalAssetId: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7
# bpn: BPNL00000003CRHK
globalAssetId: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7
key:
# Tested with Vehicle A
globalAssetId: urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e
bpn: BPNL00000003AYRE
bomLifecycle: asPlanned
callbackUrl: http://testikus.com
incidentBpns:
- BPNL00000003B6LU
incidentBPNSs:
- BPNS00000003B6LU
method: POST
headers:
content-type: application/json
Expand Down Expand Up @@ -98,15 +97,16 @@ stages:
response:
status_code: 200
verify_response_with:
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_correct_in_submodels_for_valid_ID
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_Yes
- function: local.testing.api-tests.tavern_helpers:ESS_job_parameter_are_as_requested
headers:
content-type: application/json


---


test_name: Make sure investigation job with valid globalAssetId for unknown BPN is processed correctly with MOCK
test_name: Make sure investigation job with valid globalAssetId for unknown BPN is processed correctly

strict:
- headers:off
Expand All @@ -117,14 +117,14 @@ stages:
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
json:
# key:
# globalAssetId: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7
# bpn: BPNL00000003CRHK
globalAssetId: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e9fd3a7
key:
# Tested with Vehicle A
globalAssetId: urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e
bpn: BPNL00000003AYRE
bomLifecycle: asPlanned
callbackUrl: http://testikus.com
incidentBpns:
- BPNL00ARBITRARY1
incidentBPNSs:
- BPNS00ARBITRARY9
method: POST
headers:
content-type: application/json
Expand Down Expand Up @@ -153,15 +153,16 @@ stages:
response:
status_code: 200
verify_response_with:
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_correct_in_submodels_for_valid_ID_in_unknown_BPN
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_No
- function: local.testing.api-tests.tavern_helpers:ESS_job_parameter_are_as_requested
headers:
content-type: application/json


---


test_name: Make sure investigation job with unknown globalAssetId and BPN is processed correctly with MOCK
test_name: Make sure investigation job with unknown globalAssetId and valid BPN is processed correctly

strict:
- headers:off
Expand All @@ -172,12 +173,124 @@ stages:
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
json:
# key:
# globalAssetId: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e955555
# bpn: BPNL00000003CRHK
globalAssetId: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e955555
incidentBpns:
- BPNL00000003B6LU
key:
globalAssetId: urn:uuid:2c57b0e9-a653-411d-bdcd-64787e955555
bpn: BPNL00000003AYRE
incidentBPNSs:
- BPNS00000003B6LU
method: POST
headers:
content-type: application/json
$ext:
function: local.testing.api-tests.tavern_helpers:create_bearer_token
response:
status_code: 201
headers:
content-type: application/json
save:
json:
job_id: id

- *verify_ESS_job_response_with_desired_test_steps_and_wait_up_to_15_minutes_for_COMPLETED

- name: get response for created investigation
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations/{job_id}"
params:
returnUncompletedJob: true
method: GET
headers:
content-type: application/json
$ext:
function: local.testing.api-tests.tavern_helpers:create_bearer_token
response:
status_code: 200
verify_response_with:
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_Unknown
- function: local.testing.api-tests.tavern_helpers:ESS_job_parameter_are_as_requested
headers:
content-type: application/json


---


test_name: Make sure investigation job with valid globalAssetId and valid BPN but partial supply chain is processed correctly

strict:
- headers:off
- json:off

stages:
- name: register a BPN investigation with valid globalAssetId and valid BPN
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
json:
key:
#tested with Vehicle D
globalAssetId: urn:uuid:3a2a1ca9-c6c1-49c7-a7ae-1dfc5fb9881f
bpn: BPNL00ARBITRARY8
bomLifecycle: asPlanned
callbackUrl: http://testikus.com
incidentBPNSs:
- BPNS0ARBITRARY11
method: POST
headers:
content-type: application/json
$ext:
function: local.testing.api-tests.tavern_helpers:create_bearer_token
response:
status_code: 201
headers:
content-type: application/json
save:
json:
job_id: id

- *verify_ESS_job_response_with_desired_test_steps_and_wait_up_to_15_minutes_for_COMPLETED

- name: get response for created investigation
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations/{job_id}"
params:
returnUncompletedJob: true
method: GET
headers:
content-type: application/json
$ext:
function: local.testing.api-tests.tavern_helpers:create_bearer_token
response:
status_code: 200
verify_response_with:
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_Yes
- function: local.testing.api-tests.tavern_helpers:ESS_job_parameter_are_as_requested
headers:
content-type: application/json



---


test_name: Make sure investigation job with valid globalAssetId and valid BPN but not reachable incidentBPN is processed correctly

strict:
- headers:off
- json:off

stages:
- name: register a BPN investigation with valid globalAssetId and valid BPN but not reachable incidentBPN
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
json:
key:
#tested with Vehicle B
globalAssetId: urn:uuid:68904173-ad59-4a77-8412-3e73fcafbd8b
bpn: BPNL00000003B6LU
bomLifecycle: asPlanned
callbackUrl: http://testikus.com
incidentBPNSs:
- BPNS00000003AXS3
method: POST
headers:
content-type: application/json
Expand Down Expand Up @@ -206,15 +319,16 @@ stages:
response:
status_code: 200
verify_response_with:
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_correct_in_submodels_for_unknown_ID
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_Unknown
- function: local.testing.api-tests.tavern_helpers:ESS_job_parameter_are_as_requested
headers:
content-type: application/json


---


test_name: Make sure investigation job with several relationships for valid globalAssetId and BPN is processed correctly with MOCK
test_name: Make sure investigation job with several relationships for valid globalAssetId and BPN is processed correctly

strict:
- headers:off
Expand All @@ -225,12 +339,12 @@ stages:
request:
url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
json:
# key:
# globalAssetId: urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c
# bpn: BPNL00000003CRHK
globalAssetId: urn:uuid:aad27ddb-43aa-4e42-98c2-01e529ef127c
incidentBpns:
- BPNL00ARBITRARY1
key:
# Tested with Vehicle C
globalAssetId: urn:uuid:1c7a25ea-0490-4944-b9c9-d8c666d47958
bpn: BPNL00ARBITRARY4
incidentBPNSs:
- BPNS00ARBITRARY7
method: POST
headers:
content-type: application/json
Expand Down Expand Up @@ -259,8 +373,13 @@ stages:
response:
status_code: 200
verify_response_with:
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_correct_in_submodels_for_valid_ID
- function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_Yes
- function: local.testing.api-tests.tavern_helpers:relationships_for_BPN_investigations_contains_several_childs
- function: local.testing.api-tests.tavern_helpers:ESS_job_parameter_are_as_requested
- function: local.testing.api-tests.tavern_helpers:tombstones_are_empty
- function: local.testing.api-tests.tavern_helpers:relationships_are_not_empty
- function: local.testing.api-tests.tavern_helpers:submodels_are_not_empty
- function: local.testing.api-tests.tavern_helpers:check_timestamps_for_completed_jobs
headers:
content-type: application/json

Expand All @@ -281,10 +400,12 @@ stages:
# request:
# url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
# json:
# globalAssetId: urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a9
# key:
# globalAssetId: urn:uuid:c7a2b803-f8fe-4b79-b6fc-967ce847c9a9
# bpn: BPNL00000003B0Q0
# bomLifecycle: asPlanned
# callbackUrl: http://testikus.com
# incidentBpns:
# incidentBPNSs:
# - BPNL00000003B0Q0
# method: POST
# headers:
Expand Down Expand Up @@ -314,66 +435,12 @@ stages:
# response:
# status_code: 200
# verify_response_with:
# - function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_correct_in_submodels_for_valid_ID
# - function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_Yes
# - function: local.testing.api-tests.tavern_helpers:ESS_job_parameter_are_as_requested
# headers:
# content-type: application/json
#

#---
#
#
#test_name: Make sure investigation job with valid globalAssetId and BPN is processed in submodel servers correctly in MOCK
#
#strict:
# - headers:off
# - json:off
#
#stages:
# - *authenticate_and_fetch_token
#
# - name: register a BPN investigation with valid globalAssetId for processing in submodel servers in MOCK
# request:
# url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations"
# json:
# globalAssetId: urn:uuid:1c7a25ea-0490-4944-b9c9-d8c666d47958
# incidentBpns:
# - BPNL00ARBITRARY7
# method: POST
# headers:
# content-type: application/json
# $ext:
# function: local.testing.api-tests.tavern_helpers:create_bearer_token
# response:
# status_code: 201
# headers:
# content-type: application/json
# save:
# json:
# job_id: id
#
# - *verify_ESS_job_response_with_desired_test_steps_and_wait_up_to_15_minutes_for_COMPLETED
#
# - name: get response for created investigation
# request:
# url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations/{job_id}"
# params:
# returnUncompletedJob: true
# method: GET
# headers:
# content-type: application/json
# $ext:
# function: local.testing.api-tests.tavern_helpers:create_bearer_token
# response:
# status_code: 200
# verify_response_with:
# - function: local.testing.api-tests.tavern_helpers:supplyChainImpacted_is_correct_in_submodels_for_valid_ID
# - function: local.testing.api-tests.tavern_helpers:tombstones_are_empty
# - function: local.testing.api-tests.tavern_helpers:relationships_are_not_empty
# - function: local.testing.api-tests.tavern_helpers:submodels_are_not_empty
# - function: local.testing.api-tests.tavern_helpers:check_timestamps_for_completed_jobs
# headers:
# content-type: application/json

############################## /\ ESS Tests with T-Systems and submodel servers /\ ##############################
###### !!!!!! Commented out since there is no testdata available for the moment !!!!!! ######
---
Expand Down
Loading

0 comments on commit 036edbc

Please sign in to comment.