Skip to content

Commit

Permalink
Merge pull request #46 from catenax-ng/main
Browse files Browse the repository at this point in the history
Legal header update and new Helm chart release
  • Loading branch information
ds-jkreutzfeld authored Feb 28, 2023
2 parents d6cab7e + 871c38f commit 185ddfe
Show file tree
Hide file tree
Showing 231 changed files with 1,296 additions and 729 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/helm-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Lint and Test Charts

on:
pull_request:
paths:
- 'charts/**'
workflow_dispatch:

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v1

- name: Build image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: kind-registry:5000/irs-api:testing

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.9.3

- uses: actions/setup-python@v4
with:
python-version: '3.9'
check-latest: true

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }}

- name: Run chart-testing (install)
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add minio https://charts.min.io/
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
ct install --charts charts/irs
if: steps.list-changed.outputs.changed == 'true'
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ The following subsection provides instructions for running the infrastructure on

- Start the application from your favorite IDE. For IntelliJ, a run configuration is available in the .run folder.

- **Hint**
Docker Image and Docker Compose that exist in root directory of application is only for local deployment.
It is not and should be not use in any test or production deployment.

#### Local IRS API

- Swagger UI: http://localhost:8080/api/swagger-ui
Expand Down Expand Up @@ -125,3 +121,19 @@ curl -X 'GET' 'http://localhost:8080/irs/jobs/<jobID>' -H 'accept: application/j
## Licenses

Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0) - see [LICENSE](./LICENSE)

## Notice for Docker image
This application provides container images for demonstration purposes.

DockerHub: https://hub.docker.com/r/tractusx/irs-api

Eclipse Tractus-X product(s) installed within the image:

GitHub: https://github.com/eclipse-tractusx/item-relationship-service
Project home: https://projects.eclipse.org/projects/automotive.tractusx
License: Apache License, Version 2.0
Used base image: eclipse-temurin:19-jre-alpine

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
257 changes: 252 additions & 5 deletions api-tests/irs-api-tests.tavern.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,25 @@ stages:
save:
json:
job_id: id
delay_after: 240
delay_after: 400

- name: authenticate and fetch access token
request:
url: "{tavern.env_vars.KEYCLOAK_HOST}"
method: POST
data:
grant_type: client_credentials
client_id: "{tavern.env_vars.KEYCLOAK_CLIENT_ID}"
client_secret: "{tavern.env_vars.KEYCLOAK_CLIENT_SECRET}"
response:
status_code: 200
json:
token_type: Bearer
headers:
content-type: application/json
save:
json:
access_token: access_token

- name: fetch response for created job and check details
request:
Expand Down Expand Up @@ -726,13 +744,148 @@ stages:
status_code: 400
json:
statusCode: BAD_REQUEST
error: "NoSuchElementException: Unsupported AspectType: UnknownAspect. Must be one of: AddressAspect, AssemblyPartRelationship, Batch, BatteryPass, CertificateOfDestruction, CertificateOfDismantler, ChargingProcess, ClaimData, DiagnosticData, EndOfLife, EsrCertificate, EsrCertificateStateStatistic, IdConversion, MarketplaceOffer, MaterialForHomologation, MaterialForRecycling, PartAsPlanned, PhysicalDimension, ProductDescription, ReturnRequest, SerialPartTypization, SingleLevelBomAsPlanned, SingleLevelUsageAsBuilt"
error: "Aspects did not match the available aspects: '[UnknownAspect]'"
messages: null
headers:
content-type: application/json


---


test_name: Make sure job can be returned correctly with returnUncompletedJob = true

strict:
- headers:off
- json:off

stages:
- name: authenticate and fetch access token
request:
url: "{tavern.env_vars.KEYCLOAK_HOST}"
method: POST
data:
grant_type: client_credentials
client_id: "{tavern.env_vars.KEYCLOAK_CLIENT_ID}"
client_secret: "{tavern.env_vars.KEYCLOAK_CLIENT_SECRET}"
response:
status_code: 200
json:
token_type: Bearer
headers:
content-type: application/json
save:
json:
access_token: access_token

- name: create a job and wait
request:
url: "{tavern.env_vars.IRS_HOST}/irs/jobs"
json:
globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}"
aspects:
- SerialPartTypization
- AssemblyPartRelationship
- Batch
- ProductDescription
- IdConversion
- MarketplaceOffer
- MaterialForRecycling
- PhysicalDimension
- ReturnRequest
- CertificateOfDestruction
- CertificateOfDismantler
collectAspects: true
method: POST
headers:
content-type: application/json
Authorization: "Bearer {access_token:s}"
response:
status_code: 201
json:
id: !re_fullmatch "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
headers:
content-type: application/json
save:
json:
job_id: id
delay_after: 200

- name: fetch response for running job and check existence of submodels and relationships
request:
url: "{tavern.env_vars.IRS_HOST}/irs/jobs/{job_id}"
params:
returnUncompletedJob: true
method: GET
headers:
content-type: application/json
Authorization: "Bearer {access_token:s}"
response:
status_code: 200
json:
job:
state: RUNNING
verify_response_with:
- function: api-tests.tavern_helpers:relationships_are_not_empty
- function: api-tests.tavern_helpers:submodels_are_not_empty
headers:
content-type: application/json


---


test_name: Make sure job request with invalid depth return 400-response

strict:
- headers:off
- json:off

stages:
- name: authenticate and fetch access token
request:
url: "{tavern.env_vars.KEYCLOAK_HOST}"
method: POST
data:
grant_type: client_credentials
client_id: "{tavern.env_vars.KEYCLOAK_CLIENT_ID}"
client_secret: "{tavern.env_vars.KEYCLOAK_CLIENT_SECRET}"
response:
status_code: 200
json:
token_type: Bearer
headers:
content-type: application/json
save:
json:
access_token: access_token

- name: create a job and check errors in response
request:
url: "{tavern.env_vars.IRS_HOST}/irs/jobs"
json:
globalAssetId: urn:uuid:4ad4a1ce-beb2-42d2-bfe7c6xyz009123452
collectAspects: true
depth: -10
direction: "downward"
method: POST
headers:
content-type: application/json
Authorization: "Bearer {access_token:s}"
response:
status_code: 400
verify_response_with:
function: api-tests.tavern_helpers:errors_for_invalid_depth_are_correct
json:
statusCode: BAD_REQUEST
error: Invalid Arguments.
headers:
content-type: application/json


---


test_name: Make sure job with all valid aspects is processed (1.5.0)

strict:
Expand Down Expand Up @@ -799,7 +952,25 @@ stages:
save:
json:
job_id: id
delay_after: 340
delay_after: 500

- name: authenticate and fetch access token
request:
url: "{tavern.env_vars.KEYCLOAK_HOST}"
method: POST
data:
grant_type: client_credentials
client_id: "{tavern.env_vars.KEYCLOAK_CLIENT_ID}"
client_secret: "{tavern.env_vars.KEYCLOAK_CLIENT_SECRET}"
response:
status_code: 200
json:
token_type: Bearer
headers:
content-type: application/json
save:
json:
access_token: access_token

- name: fetch response for created job and check details
request:
Expand Down Expand Up @@ -878,7 +1049,7 @@ stages:
status_code: 400
json:
statusCode: BAD_REQUEST
error: "NoSuchElementException: Unsupported AspectType: {deprecated_aspect}. Must be one of: AddressAspect, AssemblyPartRelationship, Batch, BatteryPass, CertificateOfDestruction, CertificateOfDismantler, ChargingProcess, ClaimData, DiagnosticData, EndOfLife, EsrCertificate, EsrCertificateStateStatistic, IdConversion, MarketplaceOffer, MaterialForHomologation, MaterialForRecycling, PartAsPlanned, PhysicalDimension, ProductDescription, ReturnRequest, SerialPartTypization, SingleLevelBomAsPlanned, SingleLevelUsageAsBuilt"
error: "Aspects did not match the available aspects: '[{deprecated_aspect}]'"
messages: null
headers:
content-type: application/json
Expand Down Expand Up @@ -1264,6 +1435,82 @@ stages:
---


test_name: Make sure cancellation of irs-job works correct

strict:
- headers:off
- json:off

stages:
- name: authenticate and fetch access token
request:
url: "{tavern.env_vars.KEYCLOAK_HOST}"
method: POST
data:
grant_type: client_credentials
client_id: "{tavern.env_vars.KEYCLOAK_CLIENT_ID}"
client_secret: "{tavern.env_vars.KEYCLOAK_CLIENT_SECRET}"
response:
status_code: 200
json:
token_type: Bearer
headers:
content-type: application/json
save:
json:
access_token: access_token

- name: create a job
request:
url: "{tavern.env_vars.IRS_HOST}/irs/jobs"
json:
globalAssetId: "{tavern.env_vars.GLOBAL_ASSET_ID}"
method: POST
headers:
content-type: application/json
Authorization: "Bearer {access_token:s}"
response:
status_code: 201
headers:
content-type: application/json
save:
json:
job_id: id
delay_after: 3

- name: cancel the job
request:
url: "{tavern.env_vars.IRS_HOST}/irs/jobs/{job_id}"
method: PUT
headers:
content-type: application/json
Authorization: "Bearer {access_token:s}"
response:
status_code: 200
headers:
content-type: application/json

- name: fetch response for created job
request:
url: "{tavern.env_vars.IRS_HOST}/irs/jobs/{job_id}"
params:
returnUncompletedJob: true
method: GET
headers:
content-type: application/json
Authorization: "Bearer {access_token:s}"
response:
status_code: 200
json:
job:
state: CANCELED
headers:
content-type: application/json


---


test_name: Make sure search for running jobs returns no completedOn timestamp

strict:
Expand Down Expand Up @@ -1810,4 +2057,4 @@ stages:
- function: api-tests.tavern_helpers:bpns_are_not_empty
- function: api-tests.tavern_helpers:summary_for_bpns_is_given
headers:
content-type: application/json
content-type: application/json
Loading

0 comments on commit 185ddfe

Please sign in to comment.