Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add automated Tests for semantic-hub #187

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/semantic-hub-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
###############################################################
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH
# Copyright (c) 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
###############################################################
name: Semantic-hub End-to-End tests

on:
workflow_dispatch:
inputs:
bearerToken:
description: 'bearerToken'
required: true
semantichubUrl:
description: 'semantic-hub-Url'
required: true

jobs:
end_to_end_tests:
runs-on: ubuntu-latest
name: Execute End-to-End tests

steps:
- name: Mask Input Credentials
run: |
mask_client_bearer_token=$(jq -r '.inputs.bearerToken' $GITHUB_EVENT_PATH)
echo ::add-mask::$mask_client_bearer_token
echo mask_client_bearer_token=$mask_client_bearer_token >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: "3.8"
check-latest: true

- name: Install python dependencies
working-directory: ./e2e-tests
run: |
pip install -r requirements.txt

- name: Install python dependencies
working-directory: ./e2e-tests/semantic-hub
run: |
py.test . -vv --html=./output/report.html --self-contained-html
env:
BEARER_TOKEN: ${{ env.mask_client_bearer_token }}
SEMANTIC_HUB_API_URL: ${{ inputs.semantichubUrl }}
- name: Upload test report
uses: actions/upload-artifact@v3
if: always()
with:
name: semantic-hub-e2e-test-report
path: ./e2e-tests/semantic-hub/output/report.html
3 changes: 3 additions & 0 deletions e2e-tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pytest==7.1.2
tavern==1.23.3
pytest-html==3.1.1
73 changes: 73 additions & 0 deletions e2e-tests/semantic-hub/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
###############################################################
# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH
# Copyright (c) 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
###############################################################
name: Common variable definitions
description:
Contains common variable definitions.

variables:
semantic_hub_api_url: "{tavern.env_vars.SEMANTIC_HUB_API_URL}"
bearer_token: "{tavern.env_vars.BEARER_TOKEN}"
model_bamm_urn: urn:bamm:org.eclipse.tractusx.semantics.test:1.0.0#EndToEndTest
model_bamm_urn_encoded: urn%3Abamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23EndToEndTest
model_bamm_package_urn_encoded: urn%3Abamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23
model_bamm_name: EndToEndTest
model_bamm_version: 1.0.0
model_bamm_ttl: |
@prefix : <urn:bamm:org.eclipse.tractusx.semantics.test:1.0.0#> .
@prefix bamm: <urn:bamm:io.openmanufacturing:meta-model:1.0.0#> .
@prefix bamm-c: <urn:bamm:io.openmanufacturing:characteristic:1.0.0#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:EndToEndTest
a bamm:Aspect ;
bamm:name "EndToEndTest" ;
bamm:preferredName "EndToEndTest en"@en ;
bamm:preferredName "EndToEndTest de"@de ;
bamm:properties ( :detail ) ;
bamm:operations ( ) .

:detail a bamm:Property ;
bamm:name "testString" ;
bamm:exampleValue "Example Value Test" ;
bamm:characteristic bamm-c:Text .

model_samm_urn: urn:samm:org.eclipse.tractusx.semantics.test:1.0.0#EndToEndTest
model_samm_urn_encoded: urn%3Asamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23EndToEndTest
model_samm_package_urn_encoded: urn%3Asamm%3Aorg.eclipse.tractusx.semantics.test%3A1.0.0%23
model_samm_name: EndToEndTest
model_samm_version: 1.0.0
model_samm_ttl: |
@prefix : <urn:samm:org.eclipse.tractusx.semantics.test:1.0.0#> .
@prefix samm: <urn:samm:org.eclipse.esmf.samm:meta-model:1.0.0#> .
@prefix bamm-c: <urn:samm:org.eclipse.esmf.samm:characteristic:1.0.0#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:EndToEndTest
a samm:Aspect ;
samm:name "EndToEndTest" ;
samm:preferredName "EndToEndTest en"@en ;
samm:preferredName "EndToEndTest de"@de ;
samm:properties ( :detail ) ;
samm:operations ( ) .

:detail a samm:Property ;
samm:name "testString" ;
samm:exampleValue "Example Value Test" ;
samm:characteristic bamm-c:Text .
Loading