diff --git a/.github/workflows/tavern.yml b/.github/workflows/tavern.yml index a3f29df602..b1e11ad979 100644 --- a/.github/workflows/tavern.yml +++ b/.github/workflows/tavern.yml @@ -16,10 +16,15 @@ on: description: IRS-ESS environment to test default: 'https://irs-ess.int.demo.catena-x.net' required: true - global-asset-id: + global-asset-id-asPlanned: type: string - description: Global Asset ID to use for the tests - default: 'urn:uuid:513d7be8-e7e4-49f4-a22b-8cd31317e454' + description: Global Asset ID to use for the asPlanned tests + default: 'urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e' + required: true + global-asset-id-asBuild: + type: string + description: Global Asset ID to use for the asBuild tests + default: 'urn:uuid:7940e0cc-7814-41eb-8b04-d984a325deec' required: true execution-ticket: type: string @@ -54,7 +59,8 @@ jobs: KEYCLOAK_HOST: ${{ secrets.KEYCLOAK_OAUTH2_CLIENT_TOKEN_URI }} KEYCLOAK_CLIENT_ID: ${{ secrets.KEYCLOAK_OAUTH2_CLIENT_ID }} KEYCLOAK_CLIENT_SECRET: ${{ secrets.KEYCLOAK_OAUTH2_CLIENT_SECRET }} - GLOBAL_ASSET_ID: ${{ github.event.inputs.global-asset-id || 'urn:uuid:513d7be8-e7e4-49f4-a22b-8cd31317e454' }} + GLOBAL_ASSET_ID_AS_PLANNED: ${{ github.event.inputs.global-asset-id-asPlanned || 'urn:uuid:0733946c-59c6-41ae-9570-cb43a6e4c79e' }} + GLOBAL_ASSET_ID_AS_BUILD: ${{ github.event.inputs.global-asset-id-asBuild || 'urn:uuid:7940e0cc-7814-41eb-8b04-d984a325deec' }} run: | python -m pytest local/testing/api-tests/irs-api-tests.tavern.yaml --junitxml=tavern-results.xml diff --git a/local/testing/api-tests/irs-api-tests.tavern.yaml b/local/testing/api-tests/irs-api-tests.tavern.yaml index 466c3ccb0e..171973579d 100644 --- a/local/testing/api-tests/irs-api-tests.tavern.yaml +++ b/local/testing/api-tests/irs-api-tests.tavern.yaml @@ -262,8 +262,6 @@ stages: # - json:off # #stages: -# - *authenticate_and_fetch_token -# # - name: register a BPN investigation with valid globalAssetId to T-Systems # request: # url: "{tavern.env_vars.IRS_ESS_HOST}/ess/bpn/investigations" @@ -378,7 +376,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_PLANNED}" bpn: "BPNL00000003AYRE" method: POST headers: @@ -413,7 +411,7 @@ stages: --- -test_name: Make sure job with submodels process with status COMPLETED +test_name: Make sure job with submodels process with status COMPLETED with asPlanned-id strict: - headers:off @@ -425,10 +423,13 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_PLANNED}" bpn: "BPNL00000003AYRE" collectAspects: true - depth: 1 + bomLifecycle: asPlanned + depth: 2 + aspects: + - SingleLevelUsageAsPlanned direction: "downward" method: POST headers: @@ -484,6 +485,65 @@ stages: --- +test_name: Make sure job with submodels process with status COMPLETED with asBuild-id + +strict: + - headers:off + - json:off + +stages: + - name: create a job and check for success + request: + url: "{tavern.env_vars.IRS_HOST}/irs/jobs" + json: + key: + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" + bpn: "BPNL00000003AYRE" + collectAspects: true + depth: 2 + aspects: + - ProductDescription + - CertificateOfDestruction + - SerialPart + - SingleLevelUsageAsBuilt + direction: "downward" + 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_job_is_running_and_wait_up_to_15_minutes_for_COMPLETED + + - name: verify job response with desired test steps + request: + url: "{tavern.env_vars.IRS_HOST}/irs/jobs/{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:submodels_are_not_empty + - function: local.testing.api-tests.tavern_helpers:check_timestamps_for_completed_jobs + headers: + content-type: application/json + + +--- + + test_name: Make sure job without submodels process with status COMPLETED strict: @@ -496,7 +556,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_PLANNED}" bpn: "BPNL00000003AYRE" collectAspects: false depth: 1 @@ -586,9 +646,9 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_PLANNED}" bpn: "BPNL00000003AYRE" - bomLifecycle: "asBuilt" + bomLifecycle: "asPlanned" depth: 2 collectAspects: true method: POST @@ -632,7 +692,7 @@ stages: --- -test_name: Make sure job with aspect serialPartTypization is processed (1.3.0) +test_name: Make sure job with aspect SerialPart is processed (1.3.0) strict: - headers:off @@ -644,10 +704,10 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" aspects: - - SerialPartTypization + - SerialPart collectAspects: true depth: 1 method: POST @@ -691,7 +751,7 @@ stages: --- -test_name: Make sure job with aspects SerialPartTypization and AssemblyPartRelationship is processed (1.3.1) +test_name: Make sure job with aspects SerialPart and ProductDescription is processed (1.3.1) strict: - headers:off @@ -703,11 +763,11 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" aspects: - - SerialPartTypization - - AssemblyPartRelationship + - SerialPart + - ProductDescription collectAspects: true depth: 2 method: POST @@ -751,7 +811,7 @@ stages: --- -test_name: Make sure job with aspects BatteryPass and MaterialForRecycling is processed (1.3.2) +test_name: Make sure job with aspects MaterialForRecycling is processed (1.3.2) strict: - headers:off @@ -763,10 +823,9 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "urn:uuid:0ce413e9-4e3a-4040-a529-7e10d7c61b93" bpn: "BPNL00000003AYRE" aspects: - - BatteryPass - MaterialForRecycling collectAspects: true depth: 2 @@ -811,7 +870,7 @@ stages: --- -test_name: Make sure job with aspects Batch and CertificateOfDestruction is processed (1.3.3) +test_name: Make sure job with aspect Batch is processed (1.3.3) strict: - headers:off @@ -823,12 +882,12 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" - bpn: "BPNL00000003AYRE" + globalAssetId: "urn:uuid:acf437c1-1f20-4a1b-95f6-23f711cd65f6" + bpn: "BPNL00000003AXS3" aspects: - Batch - - CertificateOfDestruction collectAspects: true + bomLifecycle: "asBuilt" depth: 2 method: POST headers: @@ -871,7 +930,7 @@ stages: --- -test_name: Make sure job with aspects SerialPartTypization and DiagnosticData is processed (1.3.4) +test_name: Make sure job with aspects SerialPart and CertificateOfDestruction is processed (1.3.4) strict: - headers:off @@ -883,11 +942,11 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" aspects: - - SerialPartTypization - - DiagnosticData + - SerialPart + - CertificateOfDestruction collectAspects: true depth: 2 method: POST @@ -943,7 +1002,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_PLANNED}" bpn: "BPNL00000003AYRE" aspects: - UnknownAspect @@ -978,13 +1037,14 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" aspects: - - SerialPartTypization - - AssemblyPartRelationship - - Batch - ProductDescription + - CertificateOfDestruction + - SerialPart + - SingleLevelUsageAsBuilt + - BatteryPass - IdConversion - MarketplaceOffer - MaterialForRecycling @@ -1007,7 +1067,7 @@ stages: save: json: job_id: id - delay_after: 200 + delay_after: 60 - name: fetch response for running job and check existence of submodels and relationships request: @@ -1082,11 +1142,11 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" aspects: - - SerialPartTypization - - AssemblyPartRelationship + - SerialPart + - SingleLevelBomAsBuilt - Batch - ProductDescription - IdConversion @@ -1122,6 +1182,7 @@ stages: save: json: job_id: id + delay_after: 300 - *verify_job_is_running_and_wait_up_to_15_minutes_for_COMPLETED @@ -1172,7 +1233,7 @@ stages: # url: "{tavern.env_vars.IRS_HOST}/irs/jobs" # json: # key: - # globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + # globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" # bpn: "BPNL00000003AYRE" # aspects: # - "{deprecated_aspect}" @@ -1291,10 +1352,10 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" aspects: - - SerialPartTypization + - SerialPart - DiagnosticData collectAspects: true method: POST @@ -1448,7 +1509,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" method: POST headers: @@ -1593,7 +1654,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" collectAspects: true depth: 1 @@ -1737,7 +1798,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_PLANNED}" bpn: "BPNL00000003AYRE" collectAspects: true depth: 2 @@ -1746,7 +1807,7 @@ stages: lookupBPNs: true callbackUrl: "https://www.check123.com" aspects: - - SerialPartTypization + - SerialPart - PartAsPlanned method: POST headers: @@ -1795,7 +1856,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" collectAspects: false depth: 1 @@ -1848,7 +1909,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" collectAspects: false lookupBPNs: true @@ -1902,7 +1963,7 @@ stages: url: "{tavern.env_vars.IRS_HOST}/irs/jobs" json: key: - globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}" + globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID_AS_BUILD}" bpn: "BPNL00000003AYRE" collectAspects: false lookupBPNs: true @@ -1984,8 +2045,8 @@ stages: - urn:uuid:492781f5-62ff-4fb2-876c-3498e2844d13 - urn:uuid:d6142601-5e09-45fe-9b42-e53cf8cd458c aspects: - - "AssemblyPartRelationship" - - "SerialPartTypization" + - "SingleLevelBomAsBuilt" + - "SerialPart" collectAspects: true lookupBPNs: true batchSize: 10 @@ -2044,8 +2105,8 @@ stages: - urn:uuid:3db730be-9de5-4db5-a58d-684de36484e7 - urn:uuid:73173bf5-08df-4898-9d6d-8899015c161e aspects: - - "AssemblyPartRelationship" - - "SerialPartTypization" + - "SingleLevelBomAsBuilt" + - "SerialPart" collectAspects: true lookupBPNs: true batchSize: 2 diff --git a/local/testing/api-tests/tavern_helpers.py b/local/testing/api-tests/tavern_helpers.py index 4467d08d78..8b0fd6b134 100644 --- a/local/testing/api-tests/tavern_helpers.py +++ b/local/testing/api-tests/tavern_helpers.py @@ -94,8 +94,8 @@ def submodels_are_not_empty(response): def errors_for_invalid_globalAssetId_are_correct(response): print(response.json().get("messages")) error_list = response.json().get("messages") - assert 'globalAssetId:size must be between 45 and 45' in error_list - assert 'globalAssetId:must match \"^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\"' in error_list + assert 'key.globalAssetId:size must be between 45 and 45' in error_list + assert 'key.globalAssetId:must match \"^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\"' in error_list def errors_for_invalid_depth_are_correct(response): @@ -121,8 +121,7 @@ def errors_for_unknown_globalAssetId_are_correct(response): print("RetryCounter: ", processingErrorRetryCounter) assert 'urn:uuid:cce14502-958a-42e1-8bb7-f4f41aaaaaaa' in catenaXId assert 'DigitalTwinRequest' in processingErrorStep - assert 'Shell for identifier urn:uuid:cce14502-958a-42e1-8bb7-f4f41aaaaaaa not found' in processingErrorDetail - #assert '404 : \"{\"error\":{\"message\":\"Shell for identifier urn:uuid:cce14502-958a-42e1-8bb7-f4f41aaaaaaa not found\",\"path\":\"/registry/shell-descriptors/urn%3Auuid%3Acce14502-958a-42e1-8bb7-f4f41aaaaaaa\",\"details\":{}}}\"' in processingErrorDetail + #assert 'Shell for identifier urn:uuid:cce14502-958a-42e1-8bb7-f4f41aaaaaaa not found' in processingErrorDetail ##commented out since this error message is not possible currently after DTR changes assert processingErrorLastAttempt is not None assert 3 is processingErrorRetryCounter @@ -286,7 +285,7 @@ def job_parameter_are_as_requested(response): assert parameter.get('lookupBPNs') is True assert parameter.get('callbackUrl') == 'https://www.check123.com' aspects_list = parameter.get("aspects") - assert 'SerialPartTypization' in aspects_list + assert 'SerialPart' in aspects_list assert 'PartAsPlanned' in aspects_list