Skip to content

Commit

Permalink
feat: extract response ids in postman collection (#352)
Browse files Browse the repository at this point in the history
* feat: add script to catch and reuse the policy id

adding a postman post-request script to add the policy-id of "asset-1" as a postman environment variable of request "Get Cached Catalogs" and reusing it in "Initiate Negotiation".

* feat: update script to use .find() instead of RegExp

* feat: carry over contractAgreementId to initiate transfer

* feat: finalize carrying over variables to the next request

* feat: add check for correct asset: "asset-1" and make sure return code for scripts is <=200 and <300

* feat: add newman tests

* feat: add header and Control Plane Management Folder in newman test

* feat: update newman command

* feat: update newman command

* feat: update path

* feat: add postman tests to check for a 200 OK response status code

* feat: add delay between postman tests

* feat: extend delay between postman tests

* feat: add check for a non-empty body in Get cached EDRs

* feat: enable verbose output and update checks for empty response body

* empty commit to restart tests

* feat: add terraform setup

* feat: update tests for collection

* feat: add missing file

* feat: update terraform setup in actions
  • Loading branch information
nikschul authored Oct 9, 2024
1 parent 96197ce commit d58833a
Show file tree
Hide file tree
Showing 4 changed files with 377 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
- name: "Setup Kubectl"
uses: azure/setup-kubectl@v4

- name: "Setup Terraform"
uses: hashicorp/setup-terraform@v3

- uses: actions/checkout@v4

- uses: eclipse-edc/.github/.github/actions/setup-build@main
Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/test_controlplane_management.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#
# Copyright (c) 2024 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: Run Newman Test for the Control Plane Management

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
newman_test:
runs-on: ubuntu-latest
steps:
- name: "Setup Helm"
uses: azure/setup-helm@v4
with:
version: v3.8.1

- name: "Setup Kubectl"
uses: azure/setup-kubectl@v4

- uses: actions/checkout@v4

- uses: eclipse-edc/.github/.github/actions/setup-build@main

- name: "Setup Terraform"
uses: hashicorp/setup-terraform@v3

- name: "Build runtime images"
working-directory: ./
run: |
./gradlew -Ppersistence=true dockerize
- name: "Create k8s Kind Cluster"
uses: helm/[email protected]
with:
config: deployment/kind.config.yaml
cluster_name: dcp-demo

- name: "Load runtime images into KinD"
run: kind load docker-image controlplane:latest dataplane:latest identity-hub:latest catalog-server:latest sts:latest -n dcp-demo

- name: "Install nginx ingress controller"
run: |-
echo "::notice title=nginx ingress on KinD::For details how to run nginx ingress on KinD check https://kind.sigs.k8s.io/docs/user/ingress/#ingress-nginx"
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s
- name: "Terraform init"
working-directory: ./deployment
run: |-
terraform init -reconfigure
- name: "Terraform plan"
working-directory: ./deployment
run: |-
terraform plan -out=$GITHUB_SHA.out
- name: "Terraform apply"
working-directory: ./deployment
run: |-
terraform apply "$GITHUB_SHA.out"
- name: "Seed dataspace"
run: |-
chmod +x seed-k8s.sh
./seed-k8s.sh
- name: "Install npm"
uses: actions/setup-node@v4
with:
node-version: 18

- name: "Install Newman"
run: npm install -g newman

- name: "Run Newman"
working-directory: ./deployment/postman
run: |-
newman run "MVD.postman_collection.json" -e "MVD K8S.postman_environment.json" --folder "ControlPlane Management" --delay-request 5000 --verbose
2 changes: 2 additions & 0 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
checkstyle:
runs-on: ubuntu-latest
steps:
- uses: hashicorp/setup-terraform@v3
- uses: actions/checkout@v4
- uses: eclipse-edc/.github/.github/actions/setup-build@main
- name: Run Checkstyle
Expand All @@ -65,6 +66,7 @@ jobs:
validate-terraform:
runs-on: ubuntu-latest
steps:
- uses: hashicorp/setup-terraform@v3
- uses: actions/checkout@v4
- name: Check Terraform files are properly formatted (run "terraform fmt -recursive" to fix)
run: |
Expand Down
Loading

0 comments on commit d58833a

Please sign in to comment.