Skip to content

Commit

Permalink
carve out smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Dec 19, 2023
1 parent 633847b commit ab902b0
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 60 deletions.
63 changes: 3 additions & 60 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,70 +117,13 @@ jobs:
retention-days: 7

smoke-tests:
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
runtime:
- "docker"
- "podman"
uses: ./.github/workflows/smoke-tests.yml
with:
py_ver: ${{ needs.file-changes.outputs.py_ver }}
needs:
- unit-test
- staticcheck
- build-containerlab
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: containerlab
- name: Move containerlab to usr/bin
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab
- name: Setup Podman
if: matrix.runtime == 'podman'
run: |
sudo apt purge -y podman
sudo mkdir -p /etc/apt/keyrings
curl -fsSL "https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key" \
| gpg --dearmor \
| sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
sudo apt-get update -qq
sudo apt-get -qq -y install podman
sudo systemctl start podman
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
cache-dependency-path: "tests/requirements.txt"
- name: Install robotframework
run: |
pip install -r tests/requirements.txt
- name: Run smoke tests
run: |
bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/01-smoke
# upload test reports as a zip file
- name: Upload test report
uses: actions/upload-artifact@v4
if: always()
with:
name: 01-smoke-log
path: ./tests/out/*.html

# upload coverage report from unit tests, as they are then
# merged with e2e tests coverage
- name: Upload coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-smoke-tests-${{ matrix.runtime }}
path: /tmp/clab-tests/coverage/*
retention-days: 7

ext-container-tests:
runs-on: ubuntu-22.04
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: smoke-tests

"on":
workflow_call:
inputs:
py_ver:
required: true
type: string

jobs:
smoke-tests:
runs-on: ubuntu-22.04
timeout-minutes: 5
strategy:
matrix:
runtime:
- "docker"
- "podman"
# allow podman job to fail, since it started to fail on github actions
continue-on-error: ${{ matrix.runtime == 'podman' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/download-artifact@v4
with:
name: containerlab

- name: Move containerlab to usr/bin
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab

- name: Setup Podman
if: matrix.runtime == 'podman'
run: |
sudo apt purge -y podman
sudo mkdir -p /etc/apt/keyrings
curl -fsSL "https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key" \
| gpg --dearmor \
| sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
| sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
sudo apt-get update -qq
sudo apt-get -qq -y install podman
sudo systemctl start podman
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.py_ver }}
cache: pip
cache-dependency-path: "tests/requirements.txt"

- name: Install robotframework
run: |
pip install -r tests/requirements.txt
- name: Run smoke tests
run: |
bash ./tests/rf-run.sh ${{ matrix.runtime }} ./tests/01-smoke
# upload test reports as a zip file
- name: Upload test report
uses: actions/upload-artifact@v4
if: always()
with:
name: 01-smoke-log-${{ matrix.runtime }}
path: ./tests/out/*.html

# upload coverage report from unit tests, as they are then
# merged with e2e tests coverage
- name: Upload coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-smoke-tests-${{ matrix.runtime }}
path: /tmp/clab-tests/coverage/*
retention-days: 7

0 comments on commit ab902b0

Please sign in to comment.