Skip to content

Commit

Permalink
Bump robot to 6.1.1, update robot syntax and install podman v4 from k…
Browse files Browse the repository at this point in the history
…ubic (#1529)

* bump robot to 6.1.1 and update syntax

* setup podman from kubic

* setup podman for srl tests

* exclude keep-mgmt-net tests from podman
  • Loading branch information
hellt authored Aug 17, 2023
1 parent fa610ec commit ac30f14
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 97 deletions.
107 changes: 24 additions & 83 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,63 +131,7 @@ jobs:
with:
name: coverage
path: ./tests/coverage/*
retention-days: 1

build-podman-v4:
env:
CGO_ENABLED: 1 # CGO is required for podman
runs-on: ubuntu-22.04
needs: file-changes
if: needs.file-changes.outputs.code == 'true' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Cache podman bin
id: cache-podman-bin
uses: actions/cache@v3
with:
path: |
./bin
key: ${{ runner.os }}-podman-${{ env.PODMAN_VER }}
restore-keys: |
${{ runner.os }}-podman
- uses: actions/checkout@v3
if: steps.cache-podman-bin.outputs.cache-hit != 'true'
with:
repository: containers/podman
ref: ${{ env.PODMAN_VER }}

- uses: WillAbides/[email protected]
if: steps.cache-podman-bin.outputs.cache-hit != 'true'
with:
go-version: ${{ env.GOVER }}

- name: Cache go modules
if: steps.cache-podman-bin.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-podman-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-podman
- name: Add build packages
if: steps.cache-podman-bin.outputs.cache-hit != 'true'
run: sudo apt update && sudo apt install -y libsystemd-dev libseccomp-dev pkg-config golang-github-proglottis-gpgme-dev

- name: Build podman v4
if: steps.cache-podman-bin.outputs.cache-hit != 'true'
run: make binaries

# store podman binary as artifact
- uses: actions/upload-artifact@v3
with:
name: podman-bins
path: bin
retention-days: 7

smoke-tests:
runs-on: ubuntu-22.04
Expand All @@ -200,7 +144,6 @@ jobs:
- unit-test
- staticcheck
- build-containerlab
- build-podman-v4
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -211,17 +154,15 @@ jobs:
name: containerlab
- name: Move containerlab to usr/bin
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab

- name: download podman bin artifact
uses: actions/download-artifact@v3
with:
name: podman-bins
- name: Move podman to /usr/bin
run: sudo mv ./podman /usr/bin && sudo chmod a+x /usr/bin/podman

- name: Enable Podman API service
run: sudo systemctl start podman

- name: Setup Podman
if: matrix.runtime == 'podman'
run: |
sudo apt purge -y podman
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt update
sudo apt install -y podman=4:4.6.1-0ubuntu22.04+obs80.5
sudo systemctl start podman
- uses: actions/setup-python@v4
with:
python-version: "3.8"
Expand All @@ -247,7 +188,7 @@ jobs:
with:
name: coverage
path: ./tests/coverage/*
retention-days: 1
retention-days: 7

ext-container-tests:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -300,7 +241,7 @@ jobs:
with:
name: coverage
path: ./tests/coverage/*
retention-days: 1
retention-days: 7

ceos-basic-tests:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -355,7 +296,7 @@ jobs:
with:
name: coverage
path: ./tests/coverage/*
retention-days: 1
retention-days: 7

srlinux-basic-tests:
runs-on: ubuntu-22.04
Expand All @@ -379,15 +320,15 @@ jobs:
- name: Move containerlab to usr/bin
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chmod a+x /usr/bin/containerlab

- name: download podman bin artifact
uses: actions/download-artifact@v3
with:
name: podman-bins
- name: Move podman to /usr/bin
run: sudo mv ./podman /usr/bin && sudo chmod a+x /usr/bin/podman

- name: Enable Podman API service
run: sudo systemctl start podman
- name: Setup Podman
if: matrix.runtime == 'podman'
run: |
sudo apt purge -y podman
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list
curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt update
sudo apt install -y podman=4:4.6.1-0ubuntu22.04+obs80.5
sudo systemctl start podman
- uses: actions/setup-python@v4
with:
Expand All @@ -414,7 +355,7 @@ jobs:
with:
name: coverage
path: ./tests/coverage/*
retention-days: 1
retention-days: 7

ixiac-one-basic-tests:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -461,7 +402,7 @@ jobs:
with:
name: coverage
path: ./tests/coverage/*
retention-days: 1
retention-days: 7

# create a job that downloads coverage artifact and uses codecov to upload it
coverage:
Expand Down
8 changes: 2 additions & 6 deletions tests/01-smoke/01-basic-flow.robot
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,8 @@ Verify Hosts entries exist

Should Be Equal As Integers ${rc} 0

IF '${runtime}' == 'podman'
Should Contain ${output} 6
END
IF '${runtime}' == 'docker'
Should Contain ${output} 6
END
IF '${runtime}' == 'podman' Should Contain ${output} 6
IF '${runtime}' == 'docker' Should Contain ${output} 6

Verify Mem and CPU limits are set
[Documentation] Checking if cpu and memory limits set for a node has been reflected in the host config
Expand Down
7 changes: 7 additions & 0 deletions tests/01-smoke/07-keep-mgmt-net.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Library OperatingSystem
Library String
Resource ../common.robot

Suite Setup Setup
Suite Teardown Run sudo -E ${CLAB_BIN} --runtime ${runtime} destroy -t ${topo} --cleanup


Expand Down Expand Up @@ -56,3 +57,9 @@ Check ${lab-name} mgmt network is gone
... sudo ip l show dev ${mgmt-bridge}
Log ${output}
Should Not Be Equal As Integers ${rc} 0


*** Keywords ***
Setup
# skipping this test suite for podman as keep-mgmt-net fails with podman for now
Skip If '${runtime}' == 'podman'
2 changes: 1 addition & 1 deletion tests/common.robot
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*** Variables ***
${CLAB_BIN} containerlab
${CLAB_BIN} containerlab
3 changes: 1 addition & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
robotframework==4.1.0
robotframework==6.1.1
robotframework-sshlibrary==3.8.0
rpaframework==14.1.0
15 changes: 10 additions & 5 deletions tests/ssh.robot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*** Settings ***
Library SSHLibrary
Library SSHLibrary


*** Keywords ***
Login via SSH with username and password
Expand All @@ -14,10 +15,12 @@ Login via SSH with username and password
FOR ${i} IN RANGE ${try_for}
SSHLibrary.Open Connection ${address} timeout=${conn_timeout}
${status}= Run Keyword And Return Status SSHLibrary.Login ${username} ${password}
Exit For Loop If ${status}
IF ${status} BREAK
Sleep 1s
END
Run Keyword If $status!=True Fail Unable to connect to ${address} via SSH in ${try_for} attempts
IF $status!=True
Fail Unable to connect to ${address} via SSH in ${try_for} attempts
END
Log Exited the loop.

Login via SSH with public key
Expand All @@ -33,8 +36,10 @@ Login via SSH with public key
FOR ${i} IN RANGE ${try_for}
SSHLibrary.Open Connection ${address} timeout=${conn_timeout}
${status}= Run Keyword And Return Status SSHLibrary.Login With Public Key ${username} ${keyfile}
Exit For Loop If ${status}
IF ${status} BREAK
Sleep 1s
END
Run Keyword If $status!=True Fail Unable to connect to ${address} via SSH in ${try_for} attempts
IF $status!=True
Fail Unable to connect to ${address} via SSH in ${try_for} attempts
END
Log Exited the loop.

0 comments on commit ac30f14

Please sign in to comment.