Sanity Tests #410
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # SPDX-FileCopyrightText: (C) 2025 Intel Corporation | |
| # SPDX-License-Identifier: Apache-2.0 | |
| name: Sanity Tests | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" # Run every day at midnight | |
| workflow_dispatch: # Run on manual trigger | |
| inputs: | |
| run-sanity-tests: | |
| description: 'Run sanity tests' | |
| required: true | |
| default: 'false' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| sanity-tests: | |
| permissions: | |
| contents: read | |
| name: Deploy Kind Orchestrator and Run Sanity Tests | |
| runs-on: ubuntu-24.04-16core-64GB | |
| timeout-minutes: 90 | |
| env: | |
| ORCH_DEFAULT_PASSWORD: ${{ secrets.ORCH_DEFAULT_PASSWORD }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: open-edge-platform/edge-manageability-framework | |
| token: ${{ secrets.SYS_ORCH_GITHUB }} | |
| persist-credentials: false | |
| - name: Set up git credentials | |
| shell: bash | |
| run: | | |
| git config --global url."https://${{ secrets.SYS_ORCH_GITHUB }}:[email protected]/".insteadOf "https://github.com/" | |
| - name: Setup asdf and install dependencies | |
| uses: open-edge-platform/orch-utils/.github/actions/setup-asdf@main # zizmor: ignore[unpinned-uses] | |
| - name: Checkout infra-charts repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: open-edge-platform/infra-charts | |
| path: infra-charts | |
| token: ${{ secrets.SYS_ORCH_GITHUB }} | |
| persist-credentials: false | |
| - name: Get current git hash of the infra-charts PR | |
| id: get-git-hash-charts | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| echo "GIT_HASH_CHARTS=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_ENV" | |
| else | |
| echo "GIT_HASH_CHARTS=${{ github.sha }}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Print current git hash of the infra-charts PR | |
| run: echo "Current infra-charts git hash is ${{ env.GIT_HASH_CHARTS }}" | |
| - name: Set custom emf deployment with branch dev/infra-charts | |
| id: custom-charts-branch | |
| env: | |
| INFRA_CHARTS_REV: ${{ env.GIT_HASH_CHARTS }} | |
| GIT_USER: "git" | |
| GIT_TOKEN: ${{ secrets.SYS_ORCH_GITHUB }} | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout -b dev/infra-charts-${INFRA_CHARTS_REV} | |
| # Replaces +/targetRevision: with the current git hash of the infra-charts PR | |
| sed -i "s/targetRevision: [a-zA-Z0-9.]\+/targetRevision: ${INFRA_CHARTS_REV}/" argocd/applications/templates/infra-core.yaml | |
| sed -i "s/targetRevision: [a-zA-Z0-9.]\+/targetRevision: ${INFRA_CHARTS_REV}/" argocd/applications/templates/infra-managers.yaml | |
| sed -i "s/targetRevision: [a-zA-Z0-9.]\+/targetRevision: ${INFRA_CHARTS_REV}/" argocd/applications/templates/infra-onboarding.yaml | |
| sed -i "s/targetRevision: [a-zA-Z0-9.]\+/targetRevision: ${INFRA_CHARTS_REV}/" argocd/applications/templates/infra-external.yaml | |
| # Replaces chart: infra/charts/{{$appName}} with path: {{$appName}} | |
| sed -i 's|chart: infra/charts/{{$appName}}|path: {{$appName}}|g' argocd/applications/templates/infra-core.yaml | |
| sed -i 's|chart: infra/charts/{{$appName}}|path: {{$appName}}|g' argocd/applications/templates/infra-managers.yaml | |
| sed -i 's|chart: infra/charts/{{$appName}}|path: {{$appName}}|g' argocd/applications/templates/infra-onboarding.yaml | |
| sed -i 's|chart: infra/charts/{{$appName}}|path: {{$appName}}|g' argocd/applications/templates/infra-external.yaml | |
| # Replaces repoURL with git URL of infra-charts repository | |
| sed -i 's|repoURL: {{ required "A valid chartRepoURL entry required!" .Values.argo.chartRepoURL }}|repoURL: https://github.com/open-edge-platform/infra-charts.git|g' argocd/applications/templates/infra-core.yaml | |
| sed -i 's|repoURL: {{ required "A valid chartRepoURL entry required!" .Values.argo.chartRepoURL }}|repoURL: https://github.com/open-edge-platform/infra-charts.git|g' argocd/applications/templates/infra-managers.yaml | |
| sed -i 's|repoURL: {{ required "A valid chartRepoURL entry required!" .Values.argo.chartRepoURL }}|repoURL: https://github.com/open-edge-platform/infra-charts.git|g' argocd/applications/templates/infra-onboarding.yaml | |
| sed -i 's|repoURL: {{ required "A valid chartRepoURL entry required!" .Values.argo.chartRepoURL }}|repoURL: https://github.com/open-edge-platform/infra-charts.git|g' argocd/applications/templates/infra-external.yaml | |
| sed -i '/var githubRepos = \[\]/a\ "https://github.com/open-edge-platform/infra-charts",' mage/Magefile.go | |
| git commit -a -m "Custom infra-charts PR ${INFRA_CHARTS_REV}" | |
| git push origin dev/infra-charts-${INFRA_CHARTS_REV} | |
| - name: Get current git hash of the emf PR | |
| id: get-git-hash-deploy | |
| run: echo "GIT_HASH_DEPLOY=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV" | |
| - name: Print current git hash of the emf PR | |
| run: echo "Current emf git hash is ${{ env.GIT_HASH_DEPLOY }}" | |
| - name: Deploy External Orchestrator | |
| id: deploy-orch | |
| env: | |
| GIT_USER: "git" | |
| GIT_TOKEN: ${{ secrets.SYS_ORCH_GITHUB }} | |
| EDGE_MANAGEABILITY_FRAMEWORK_REV: ${{ env.GIT_HASH_DEPLOY }} | |
| DOCKERHUB_TOKEN: ${{ secrets.SYS_DOCKERHUB_RO }} | |
| DOCKERHUB_USERNAME: ${{ secrets.SYS_DOCKERHUB_USERNAME }} | |
| run: | | |
| set +x | |
| echo "Starting to deploy Orchestrator..." | |
| mage deploy:kindAll | |
| echo "Orchestrator deployment done!" | |
| echo "Root App Status:" | |
| kubectl -n dev get applications root-app -o yaml | |
| echo "Adds Aargo Github Reopos..." | |
| mage argo:login | |
| mage argo:addGithubRepos | |
| - name: Verify Kind Deployment | |
| id: verify-emf | |
| timeout-minutes: 25 | |
| run: | | |
| echo "Starting to verify Orchestrator deployment..." | |
| mage deploy:waitUntilComplete | |
| echo "Orchestrator deployment verified!" | |
| mage router:stop router:start | |
| echo "Router restarted" | |
| - name: Setup Test environment | |
| shell: bash | |
| run: | | |
| sudo awk -i inplace '/BEGIN ORCH DEVELOPMENT HOSTS/,/END ORCH DEVELOPMENT HOSTS/ { next } 1' /etc/hosts | |
| sudo awk -i inplace '/BEGIN ORCH SRE DEVELOPMENT HOST/,/END ORCH SRE DEVELOPMENT HOST/ { next } 1' /etc/hosts | |
| mage gen:hostfileTraefik | sudo tee -a /etc/hosts > /dev/null | |
| echo "Updated Hostfile entries!" | |
| mage gen:orchCa deploy:orchCa | |
| - name: Setup users and project/org | |
| shell: bash | |
| run: | | |
| mage tenantUtils:createDefaultMtSetup | |
| echo "Orch org/project/users created!" | |
| echo "Project uID:" | |
| kubectl get projects.project -o json | jq -r ".items[0].status.projectStatus.uID" | |
| - name: Setup edge-node-simulator | |
| shell: bash | |
| timeout-minutes: 10 | |
| run: | | |
| echo "Starting to instantiate ensim" | |
| helm upgrade --install -n orch-infra ensim \ | |
| oci://registry-rs.edgeorchestration.intel.com/edge-orch/infra/charts/ensim \ | |
| --set global.registry.name=registry-rs.edgeorchestration.intel.com/edge-orch/ \ | |
| --set configArgs.server.orchFQDN=kind.internal \ | |
| --set tlsSecretName=gateway-ca-cert | |
| echo "Wait for ensim to be running!" | |
| sleep 5 | |
| kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=ensim -n orch-infra --timeout=5m | |
| - name: Checkout ensim (virtual-edge-node) repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: open-edge-platform/virtual-edge-node | |
| path: virtual-edge-node | |
| token: ${{ secrets.SYS_ORCH_GITHUB }} | |
| persist-credentials: false | |
| - name: Checkout latest released tag of virtual-edge-node/edge-node-simulator repository | |
| working-directory: virtual-edge-node | |
| shell: bash | |
| run: | | |
| echo "Fetching all tags..." | |
| git fetch --tags | |
| echo "Finding the latest tag matching 'edge-node-simulator/v*'..." | |
| LATEST_TAG=$(git tag -l "edge-node-simulator/v*" | sort -V | tail -n 1) | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "No tags found matching 'edge-node-simulator/x.y.z'. Exiting." | |
| exit 1 | |
| fi | |
| echo "Checking out the latest tag: $LATEST_TAG" | |
| git checkout $LATEST_TAG | |
| - name: Install virtual-edge-node tools-versions | |
| working-directory: virtual-edge-node | |
| shell: bash | |
| run: | | |
| asdf install | |
| - name: Run E2E integration tests | |
| working-directory: virtual-edge-node/edge-node-simulator | |
| env: | |
| CA_PATH: ${{ github.workspace }}/orch-ca.crt | |
| PASSWORD: 'ChangeMeOn1stLogin!' | |
| PROJECT: 'sample-project' | |
| shell: bash | |
| run: | | |
| echo "Set port-forward to ensim/api" | |
| kubectl port-forward svc/ensim -n orch-infra --address 0.0.0.0 3196:3196 & | |
| kubectl port-forward svc/apiv2-proxy -n orch-infra --address 0.0.0.0 8080:8080 & | |
| echo "Runs day0 tests" | |
| # Runs day0 integration tests | |
| ginkgo -v -r --fail-fast --race --json-report infra-tests-day0.json --output-dir . --label-filter="infra-tests-day0" ./test/infra -- \ | |
| -project=${PROJECT} -caFilepath=${CA_PATH} -simAddress=127.0.0.1:3196 \ | |
| -clusterFQDN=kind.internal \ | |
| -edgeAPIUser=sample-project-api-user -edgeAPIPass=${PASSWORD} \ | |
| -edgeOnboardUser=sample-project-onboarding-user -edgeOnboardPass=${PASSWORD} | |
| echo "Runs day1 tests" | |
| # Runs day1 integration tests | |
| ginkgo -v -r --fail-fast --race --json-report infra-tests-day1.json --output-dir . --label-filter="infra-tests-day1" ./test/infra -- \ | |
| -project=${PROJECT} -caFilepath=${CA_PATH} -simAddress=127.0.0.1:3196 \ | |
| -clusterFQDN=kind.internal \ | |
| -edgeAPIUser=sample-project-api-user -edgeAPIPass=${PASSWORD} \ | |
| -edgeOnboardUser=sample-project-onboarding-user -edgeOnboardPass=${PASSWORD} | |
| echo "Runs day2 tests" | |
| # Runs day2 integration tests | |
| ginkgo -v -r --fail-fast --race --json-report infra-tests-day2.json --output-dir . --label-filter="infra-tests-day2" ./test/infra -- \ | |
| -project=${PROJECT} -caFilepath=${CA_PATH} -simAddress=127.0.0.1:3196 \ | |
| -clusterFQDN=kind.internal \ | |
| -edgeAPIUser=sample-project-api-user -edgeAPIPass=${PASSWORD} \ | |
| -edgeOnboardUser=sample-project-onboarding-user -edgeOnboardPass=${PASSWORD} | |
| echo "Run hosts/locations cleanup" | |
| ginkgo -v -r --fail-fast --race --label-filter="cleanup" ./test/infra -- \ | |
| -project=${PROJECT} -caFilepath=${CA_PATH} -simAddress=127.0.0.1:3196 \ | |
| -clusterFQDN=kind.internal \ | |
| -edgeAPIUser=sample-project-api-user -edgeAPIPass=${PASSWORD} \ | |
| -edgeOnboardUser=sample-project-onboarding-user -edgeOnboardPass=${PASSWORD} | |
| echo "Kill port-forward to ensim/api" | |
| kill $(ps -eaf | grep 'kubectl' | grep 'port-forward svc/ensim' | awk '{print $2}') | |
| kill $(ps -eaf | grep 'kubectl' | grep 'port-forward svc/api' | awk '{print $2}') | |
| echo "Retrieve ensim logs" | |
| kubectl -n orch-infra logs deploy/ensim > ensim.logs.txt | |
| - name: Upload E2E integration tests artifacts | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: e2e-int-tests-artifacts | |
| path: | | |
| ${{ github.workspace }}/virtual-edge-node/edge-node-simulator/infra-tests-day0.json | |
| ${{ github.workspace }}/virtual-edge-node/edge-node-simulator/infra-tests-day1.json | |
| ${{ github.workspace }}/virtual-edge-node/edge-node-simulator/infra-tests-day2.json | |
| ${{ github.workspace }}/virtual-edge-node/edge-node-simulator/ensim.logs.txt | |
| - name: Checkout infra-core/api repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: open-edge-platform/infra-core | |
| path: infra-core | |
| token: ${{ secrets.SYS_ORCH_GITHUB }} | |
| persist-credentials: false | |
| - name: Checkout latest released tag of infra-core/apiv2 repository | |
| working-directory: infra-core | |
| shell: bash | |
| run: | | |
| echo "Fetching all tags..." | |
| git fetch --tags | |
| echo "Finding the latest tag matching 'apiv2/v*'..." | |
| LATEST_TAG=$(git tag -l "apiv2/v*" | sort -V | tail -n 1) | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "No tags found matching 'apiv2/v*'. Exiting." | |
| exit 1 | |
| fi | |
| echo "Checking out the latest tag: $LATEST_TAG" | |
| git checkout $LATEST_TAG | |
| - name: Run API integration tests | |
| working-directory: infra-core/apiv2 | |
| env: | |
| KEYCLOAK_URL: "https://keycloak.kind.internal" | |
| USERNAME: "sample-project-api-user" | |
| PASSWORD: 'ChangeMeOn1stLogin!' | |
| API_URL: "http://127.0.0.1:8080/" | |
| CA_PATH: ${{ github.workspace }}/orch-ca.crt | |
| shell: bash | |
| run: | | |
| JWT_TOKEN=$(curl -k --location --request POST ${KEYCLOAK_URL}/realms/master/protocol/openid-connect/token --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=password' --data-urlencode 'client_id=system-client' --data-urlencode username=${USERNAME} --data-urlencode password=${PASSWORD} --data-urlencode 'scope=openid profile email groups' | jq -r '.access_token') | |
| PROJECT_ID=$(kubectl get projects.project -o json | jq -r ".items[0].status.projectStatus.uID") | |
| echo "Init port-forward to apiv2-proxy" | |
| kubectl port-forward svc/apiv2-proxy -n orch-infra --address 0.0.0.0 8080:8080 & | |
| echo "Run API integration tests" | |
| # Runs host integration tests from test/client | |
| make int-test-host JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs phy location integration tests from test/client | |
| make int-test-location JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs os integration tests from test/client | |
| make int-test-os JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs repeated schedule integration tests from test/client | |
| make int-test-sr JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs repeated schedule integration tests from test/client | |
| make int-test-ss JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs workload integration tests from test/client | |
| make int-test-workload JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs instance integration tests from test/client | |
| make int-test-instance JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs provider integration tests from test/client | |
| make int-test-provider JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| # Runs telemetry integration tests from test/client | |
| make int-test-telemetry JWT_TOKEN=${JWT_TOKEN} PROJECT_ID=${PROJECT_ID} API_URL=${API_URL} CA_PATH=${CA_PATH} | |
| echo "Kill port-forward to apiv2-proxy" | |
| kill $(ps -eaf | grep 'kubectl' | grep 'port-forward svc/apiv2-proxy' | awk '{print $2}') | |
| - name: Clean custom branch dev/infra-charts | |
| if: ${{ always() && steps.custom-charts-branch.conclusion == 'success' }} | |
| env: | |
| INFRA_CHARTS_REV: ${{ env.GIT_HASH_CHARTS }} | |
| GIT_USER: "git" | |
| GIT_TOKEN: ${{ secrets.SYS_ORCH_GITHUB }} | |
| run: | | |
| set +x | |
| echo "Deleting branch dev/infra-charts-${INFRA_CHARTS_REV}" | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git push origin --delete dev/infra-charts-${INFRA_CHARTS_REV} | |
| - name: Get diagnostic information | |
| id: diagnostic-info | |
| if: ${{ always() && steps.deploy-orch.conclusion == 'success' }} | |
| run: | | |
| kubectl get pods -o wide -A | tee pods-list.txt | |
| kubectl describe pods -A | tee pods-describe.txt | |
| mage logutils:collectArgoDiags | tee argo-diag.txt | |
| kubectl get applications -o yaml -A | tee argocd-applications.yaml | |
| - name: Get logs from pods - diagnostic information | |
| id: diagnostic-info-logs | |
| if: ${{ always() && steps.deploy-orch.conclusion == 'success' }} | |
| shell: bash | |
| run: | | |
| echo "Collect logs from all pods in orch-infra namespace" | |
| pods=$(kubectl get pods -n orch-infra -o name | cut -d'/' -f2) | |
| echo "$pods" | |
| for pod in $pods; do | |
| mkdir -p logs/$pod | |
| containers=$(kubectl get pod $pod -n orch-infra -o jsonpath='{.spec.containers[*].name}') | |
| for container in $containers; do | |
| kubectl logs $pod -c $container -n orch-infra > "logs/$pod/${container}.log" | |
| done | |
| done | |
| - name: Upload diagnostic artifacts | |
| if: ${{ always() && steps.diagnostic-info.conclusion == 'success' && steps.diagnostic-info-logs.conclusion == 'success' }} | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: pods-apps-logs | |
| path: | | |
| argo-diag.txt | |
| pods-describe.txt | |
| pods-list.txt | |
| argocd-applications.yaml | |
| logs/** |