Skip to content

Commit

Permalink
Merge pull request #552 from catenax-ng/main
Browse files Browse the repository at this point in the history
Publish swagger, fix CVE-2024-22262, improve tavern test readme
  • Loading branch information
ds-jhartmann authored Apr 23, 2024
2 parents fa85eaf + 3f5c59f commit 0a145bb
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 127 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/publish-documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build API documentation with Maven
run: |
mvn clean package -pl irs-common,irs-models,irs-policy-store,irs-testing,irs-edc-client,irs-registry-client,irs-api -DskipTests --batch-mode
cp irs-api/target/generated-sources/openapi/index.html docs/src/docs/api-specification/index.html
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down Expand Up @@ -112,10 +107,26 @@ jobs:
run: |
mv docs/src/diagram-replacer/assets/ docs/target/generated-docs/assets/
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1
with:
output: swagger-ui
spec-file: docs/src/api/irs-api.yaml

- name: Update documentation on GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3.9.3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "./docs/target/generated-docs"
destination_dir: "docs"

- name: Deploy Swagger UI to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: "swagger-ui"
destination_dir: "docs/swagger-ui"


173 changes: 87 additions & 86 deletions DEPENDENCIES

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions docs/src/docs/api-specification/api-specification.adoc

This file was deleted.

5 changes: 0 additions & 5 deletions docs/src/docs/api-specification/api.adoc

This file was deleted.

10 changes: 0 additions & 10 deletions docs/src/docs/api-specification/index.html

This file was deleted.

4 changes: 2 additions & 2 deletions docs/src/docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
== Administration Guide
xref:administration/administration-guide.adoc[]

== API-Documentation
xref:api-specification/api-specification.adoc[OpenApi specification]
== Swagger-UI
xref:swagger-ui/index.adoc[Swagger-UI]

== Architecture Documentation (arc42)
- xref:arc42/index.adoc[Single chapters]
Expand Down
13 changes: 13 additions & 0 deletions docs/src/docs/swagger-ui/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
= Swagger-UI

== NOTICE

This work is licensed under the https://www.apache.org/licenses/LICENSE-2.0[Apache-2.0].

- SPDX-License-Identifier: Apache-2.0
- SPDX-FileCopyrightText: 2021, 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
- SPDX-FileCopyrightText: 2022, 2023 BOSCH AG
- SPDX-FileCopyrightText: 2021, 2022 ZF Friedrichshafen AG
- SPDX-FileCopyrightText: 2022 ISTOS GmbH
- SPDX-FileCopyrightText: 2021, 2023 Contributors to the Eclipse Foundation
- Source URL: https://github.com/eclipse-tractusx/item-relationship-service
31 changes: 19 additions & 12 deletions local/testing/api-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ This folder contains [Tavern](https://tavern.readthedocs.io) API tests for the I

## Usage

* Install python
* Install pytest: ```py -m pip install pytest```
* Install tavern: ```py -m pip install tavern```
* Create variable.env in directory api-tests
* Copy content to variable.env
1. Install python
2. Install pytest: ```py -m pip install pytest```
3. Install tavern: ```py -m pip install tavern```
4. Create variable.env in directory api-tests
5. Copy content to variable.env
```
# this is temporary file for local development to setup environments variable such a secrets and URLs
# to run it just execute in console:
Expand All @@ -26,11 +26,18 @@ export ADMIN_USER_API_KEY=
export REGULAR_USER_API_KEY_ESS=
export ADMIN_USER_API_KEY_ESS=
```
* Execute command
```console
source variable.env
py -m pytest irs-api-tests.tavern.yaml
```


6. Execute tests
1. Run all tests
```console
source variable.env
py -m pytest local/testing/api-tests/irs-api-tests.tavern.yaml
```

2. To run a single test:
```console
py -m pytest local/testing/api-tests/irs-api-tests.tavern.yaml::"<test name>"
# for example:
py -m pytest local/testing/api-tests/irs-api-tests.tavern.yaml::"Make sure job with submodels process with status COMPLETED with asPlanned-id"
```
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<irs-registry-client.version>1.10.0-SNAPSHOT</irs-registry-client.version>

<!-- Dependencies -->
<springboot.version>3.1.10</springboot.version>
<springboot.version>3.1.11</springboot.version>
<springdoc.version>2.2.0</springdoc.version>
<micrometer.version>1.11.4</micrometer.version>
<datafaker.version>1.9.0</datafaker.version>
Expand Down

0 comments on commit 0a145bb

Please sign in to comment.