use run-tests action in all workflows (#396)

* use run-tests action in advanced workflow
* use run-tests action in performance workflow
* use run-tests action in docker-compose workflow
* use run-tests action in quali advanced workflow
* use run-tests action in quali basic manual workflow

Signed-off-by: Max Brenner <xamrennerb@gmail.com>
This commit is contained in:
Max
2022-02-24 15:19:51 +01:00
committed by GitHub
parent 0ff2af8b65
commit dd219e72bd
6 changed files with 63 additions and 560 deletions

View File

@@ -1,8 +1,5 @@
name: advanced testing
env:
ALLURE_CLI_VERSION: 2.14.0
on:
workflow_dispatch:
@@ -42,11 +39,13 @@ jobs:
- advanced-02
steps:
- uses: actions/checkout@v2
- name: install aws CLI tool
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
- name: install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
@@ -55,117 +54,21 @@ jobs:
- name: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- name: set job name
id: job
run: echo "::set-output name=name::advanced-ci-${{ github.run_number }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_number }}-${{ matrix.testbed }}"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: create configuration.py secret
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -c
- |
cd tests
pytest -m "advance" -s -vvv --testbed=${{ matrix.testbed }} --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
until [[ ! -z "$EXIT_CODE" ]]; do EXIT_CODE=$(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}"); sleep 1; done;
exit $EXIT_CODE
- name: upload Allure results as artifact
if: ${{ always() }}
uses: actions/upload-artifact@v2
uses: ./.github/actions/run-tests
with:
name: allure-results-${{ matrix.testbed }}
path: allure-results
- name: cleanup
if: ${{ always() }}
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
namespace: ${{ steps.namespace.outputs.name }}
testbed: ${{ matrix.testbed }}
marker_expression: advance
configuration: "${{ secrets.LAB_CONFIGURATION }}"
testing_docker_image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
allure_results_artifact_name: allure-results-${{ matrix.testbed }}
report:
needs: [ test ]
@@ -178,9 +81,7 @@ jobs:
- advanced-01
- advanced-02
steps:
- name: checkout testing repo
uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: allure-results-${{ matrix.testbed }}

View File

@@ -7,7 +7,6 @@ env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
ALLURE_CLI_VERSION: 2.14.0
on:
repository_dispatch:
@@ -88,15 +87,6 @@ jobs:
with:
path: wlan-testing
# build and push docker-compose-deployment image
# - name: docker login
# run: docker login ${{ env.DOCKER_SERVER }} -u ${{ env.DOCKER_USER_NAME }} -p ${{ env.DOCKER_USER_PASSWORD }}
# - name: build docker image
# working-directory: wlan-testing/docker-compose/openwifi
# run: docker build -t ${{ env.DOCKER_SERVER }}/docker-compose-deployment:${{ github.run_id }} .
# - name: push docker image
# run: docker push ${{ env.DOCKER_SERVER }}/docker-compose-deployment:${{ github.run_id }}
#
- name: Prepare certificates from secrets
working-directory: wlan-testing/docker-compose/openwifi
run: |
@@ -358,24 +348,14 @@ jobs:
runs-on: ubuntu-latest
needs: [ build, deploy-controller ]
steps:
- uses: actions/checkout@v2
- name: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- name: set job name
id: job
run: echo "::set-output name=name::testing-${{ github.run_number }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: create configuration.py secret
@@ -385,98 +365,16 @@ jobs:
EOF
sed -i -r "s/'url': ('|\").*('|\")/'url': 'https:\/\/${{ needs.deploy-controller.outputs.sec_url }}:16001'/" configuration.py
sed -i -r "s/'password': ('|\")openwifi('|\")/'password': '"${{ secrets.OWSEC_NEW_PASSWORD }}"'/" configuration.py
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -c
- |
cd tests
pytest -m "${{ github.event.inputs.marker_expression || 'sdk_restapi' }}" -s -vvv --testbed="${{ github.event.inputs.testbeds || 'basic-05' }}" --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
#sleep 30 # wait for the pod to come up
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
until [[ ! -z "$EXIT_CODE" ]]; do EXIT_CODE=$(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}"); sleep 1; done;
exit $EXIT_CODE
- name: print logs
if: always()
run: |
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl logs $podname
- name: upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v2
uses: ./.github/actions/run-tests
with:
name: allure-results-docker-compose-${{ github.event.inputs.marker_expression || 'sdk_restapi' }}
path: allure-results
- name: cleanup
if: always()
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
namespace: ${{ steps.namespace.outputs.name }}
testbed: "${{ github.event.inputs.testbeds || 'basic-05' }}"
marker_expression: "${{ github.event.inputs.marker_expression || 'sdk_restapi' }}"
configuration_file: "./configuration.py"
testing_docker_image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
allure_results_artifact_name: allure-results-docker-compose-${{ github.event.inputs.marker_expression || 'sdk_restapi' }}
report:
runs-on: ubuntu-latest
@@ -536,9 +434,6 @@ jobs:
registry_user: wlan-testing-cicd
registry_password: ${{ secrets.DOCKER_USER_PASSWORD }}
# - name: cleanup docker-compose-deployment image
# run: curl -u${{ env.DOCKER_USER_NAME }}:${{ env.DOCKER_USER_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-docker-repo/docker-compose-deployment/${{ github.run_id }}"
destroy-controller:
needs: [ test ]
runs-on: ubuntu-latest

View File

@@ -1,16 +1,4 @@
name: performance testing
env:
# AWS credentials
AWS_EKS_NAME: tip-wlan-main
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-2
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
# Cloud SDK certs
CACERT: ${{ secrets.CACERT }}
CAKEY: ${{ secrets.CAKEY }}
on:
workflow_dispatch:
inputs:
@@ -38,6 +26,13 @@ jobs:
test:
runs-on: [ self-hosted, small ]
needs: [ build ]
env:
AWS_EKS_NAME: tip-wlan-main
AWS_DEFAULT_OUTPUT: json
AWS_DEFAULT_REGION: us-east-2
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
strategy:
max-parallel: 1
fail-fast: false
@@ -65,10 +60,6 @@ jobs:
- name: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: set job name
id: job
run: echo "::set-output name=name::perf-${{ github.run_id }}"
- name: set testbed
id: testbed
run: echo "::set-output name=name::${{ github.event.inputs.testbed || 'basic-01' }}"
@@ -77,108 +68,18 @@ jobs:
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}-${{ steps.testbed.outputs.name }}"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: create configuration.py secret
run: |
cat << EOF > configuration.py
${{ secrets.LAB_CONFIGURATION }}
EOF
sed -i -r "s/'password': ('|\")openwifi('|\")/'password': '"${{ secrets.OWSEC_NEW_PASSWORD }}"'/" configuration.py
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run perf tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -c
- |
cd tests
pytest -m "performance and ${{ matrix.marker }}" -s -vvv --testbed="${{ steps.testbed.outputs.name }}" --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
#sleep 30 # wait for the pod to come up
until [ -s test_everything.xml ]
do
sleep 10
echo "waiting for tests to complete..."
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
until [[ ! -z "$EXIT_CODE" ]]; do EXIT_CODE=$(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}"); sleep 1; done;
exit $EXIT_CODE
- name: print logs
if: always()
run: |
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl logs $podname
- name: upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v2
- name: run tests
uses: ./.github/actions/run-tests
with:
name: allure-results-${{ matrix.marker }}
path: allure-results
namespace: ${{ steps.namespace.outputs.name }}
testbed: ${{ steps.testbed.outputs.name }}
marker_expression: "performance and ${{ matrix.marker }}"
configuration: "${{ secrets.LAB_CONFIGURATION }}"
testing_docker_image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
allure_results_artifact_name: allure-results-${{ matrix.marker }}
- name: cleanup
if: always()
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
report:
runs-on: ubuntu-latest
needs: [ test ]

View File

@@ -1,8 +1,5 @@
name: Quali advanced testing
env:
ALLURE_CLI_VERSION: 2.14.0
on:
workflow_dispatch:
inputs:
@@ -128,21 +125,10 @@ jobs:
- name: get EKS access credentials
run: aws eks update-kubeconfig --name ${{ env.AWS_EKS_NAME }}
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- name: set job name
id: job
run: echo "::set-output name=name::advanced-ci-${{ github.run_number }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}-$(echo ${{ matrix.ap_model }} | tr '[:upper:]' '[:lower:]' | tr '_' '-')"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: prepare configuration
@@ -282,91 +268,17 @@ jobs:
}
EOF
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -c
- |
HOSTS="sec-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build"
for HOST in \$HOSTS; do
HOST_ENTRY=""
until [[ ! -z "\$HOST_ENTRY" ]]; do sleep 1; HOST_ENTRY=\$(getent hosts \$HOST); done;
echo "\$HOST_ENTRY" >> /etc/hosts
echo "DNS record for \$HOST resolved successfully!"
done
cat /etc/hosts
cd tests
pytest -m "${{ needs.vars.outputs.marker_expression }}" -s -vvv --testbed="advanced" --alluredir=/tmp/allure-results -o firmware="${{ needs.vars.outputs.ap_version }}"
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
until [[ ! -z "$EXIT_CODE" ]]; do EXIT_CODE=$(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}"); sleep 1; done;
exit $EXIT_CODE
uses: ./.github/actions/run-tests
with:
namespace: ${{ steps.namespace.outputs.name }}
testbed: advanced
marker_expression: "${{ needs.vars.outputs.marker_expression }}"
configuration_file: "./configuration.py"
testing_docker_image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
additional_args: '-o firmware="${{ needs.vars.outputs.ap_version }}"'
allure_results_artifact_name: allure-results-${{ matrix.ap_model }}
dns_records_to_resolve: "sec-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build"
- name: show gw logs
if: failure()
@@ -384,18 +296,6 @@ jobs:
if: failure()
run: kubectl -n openwifi-${{ steps.reservation.outputs.namespace }} logs deployment/owsec
- name: upload Allure results as artifact
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: allure-results-${{ matrix.ap_model }}
path: allure-results
- name: cleanup
if: ${{ always() }}
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
- name: stop reservation
if: always()
run: python .quali/stop_reservation.py ${{ steps.reservation.outputs.identifier }}

View File

@@ -11,10 +11,6 @@ env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CLIENT_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CLIENT_KEY }}
# Cloud SDK certs
CACERT: ${{ secrets.CACERT }}
CAKEY: ${{ secrets.CAKEY }}
ALLURE_CLI_VERSION: 2.14.0
on:
workflow_dispatch:
@@ -116,21 +112,10 @@ jobs:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: install Allure CLI tool
run: |
wget https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/${{ env.ALLURE_CLI_VERSION }}/allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
tar -xzf allure-commandline-${{ env.ALLURE_CLI_VERSION }}.tgz
- name: set job name
id: job
run: echo "::set-output name=name::manual-${{ github.run_id }}"
- name: prepare namespace
id: namespace
run: |
NAMESPACE="testing-${{ github.run_id }}"
kubectl create ns $NAMESPACE
kubectl config set-context --current --namespace=$NAMESPACE
echo "::set-output name=name::${NAMESPACE}"
- name: prepare configuration
@@ -241,106 +226,17 @@ jobs:
}
EOF
kubectl create secret generic configuration --from-file=configuration=./configuration.py
- name: run tests
run: |
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
name: "${{ steps.job.outputs.name }}"
spec:
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
containers:
- name: tests
image: ${{ env.DOCKER_SERVER }}/cloud-sdk-nightly:${{ github.run_id }}
resources:
requests:
memory: "512Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "250m"
command:
- /bin/bash
- -c
- |
HOSTS="sec-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build"
for HOST in \$HOSTS; do
HOST_ENTRY=""
until [[ ! -z "\$HOST_ENTRY" ]]; do sleep 1; HOST_ENTRY=\$(getent hosts \$HOST); done;
echo "\$HOST_ENTRY" >> /etc/hosts
echo "DNS record for \$HOST resolved successfully!"
done
cd tests
pytest -m "${{ github.event.inputs.marker_expression }}" -s -vvv --testbed="basic" -o firmware="${{ github.event.inputs.firmware }}" --alluredir=/tmp/allure-results
ret=\$?
# sleep some time to be able to download the Allure results
sleep 60
exit \$ret
volumeMounts:
- name: configuration
mountPath: "/wlan-testing/tests/configuration.py"
subPath: configuration
readOnly: true
nodeSelector:
env: tests
tolerations:
- key: "tests"
operator: "Exists"
effect: "NoSchedule"
imagePullSecrets:
- name: tip-docker-registry-key
restartPolicy: Never
volumes:
- name: configuration
secret:
secretName: configuration
backoffLimit: 0
EOF
# wait for pod to spawn
sleep 1
podname=$(kubectl get pods --no-headers -o custom-columns=":metadata.name" -l job-name="${{ steps.job.outputs.name }}" | sed "s/pod\///")
kubectl wait "pod/$podname" --for condition=ready --timeout=600s
kubectl logs -f $podname &
until [ -s test_everything.xml ]
do
sleep 10
kubectl cp $podname:/wlan-testing/tests/test_everything.xml test_everything.xml >/dev/null 2>&1
done
echo "tests completed"
echo "downloading allure results..."
kubectl cp $podname:/tmp/allure-results allure-results >/dev/null 2>&1
echo "waiting for pod to exit"
kubectl logs -f $podname >/dev/null 2>&1
exit $(kubectl get pod $podname --output="jsonpath={.status.containerStatuses[].state.terminated.exitCode}")
- name: upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v2
uses: ./.github/actions/run-tests
with:
name: allure-results
path: allure-results
- name: generate Allure report
run: allure-${{ env.ALLURE_CLI_VERSION }}/bin/allure generate allure-results
- name: upload Allure report as artifact
uses: actions/upload-artifact@v2
with:
name: allure-report
path: allure-report
- name: cleanup
if: always()
run: |
kubectl delete ns "${{ steps.namespace.outputs.name }}" --wait=true
namespace: ${{ steps.namespace.outputs.name }}
testbed: basic
marker_expression: ${{ github.event.inputs.marker_expression }}
configuration_file: "./configuration.py"
testing_docker_image: tip-tip-wlan-cloud-docker-repo.jfrog.io/cloud-sdk-nightly:${{ github.run_id }}
additional_args: '-o firmware="${{ github.event.inputs.firmware }}"'
allure_results_artifact_name: allure-results
dns_records_to_resolve: "sec-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build gw-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build fms-${{ steps.reservation.outputs.namespace }}.cicd.lab.wlan.tip.build"
- name: stop reservation
if: always()
@@ -350,6 +246,17 @@ jobs:
CLOUDSHELL_USER: ${{ secrets.CLOUDSHELL_USER }}
CLOUDSHELL_PASSWORD: ${{ secrets.CLOUDSHELL_PASSWORD }}
- name: generate Allure report
uses: ./.github/actions/generate-allure-report
with:
results_path: ./allure-results
- name: upload Allure report as artifact
uses: actions/upload-artifact@v2
with:
name: allure-report
path: allure-report
cleanup:
needs: [ test ]
runs-on: ubuntu-latest

View File

@@ -137,7 +137,6 @@ jobs:
echo "::set-output name=name::${NAMESPACE}"
- name: prepare configuration
id: configuration
run: |
cat << EOF > configuration.py
Customer = ''