Skip to content

Commit

Permalink
.github: add test of all enrt recipes
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Lichtner <[email protected]>
  • Loading branch information
olichtne committed Nov 1, 2024
1 parent d6c1046 commit 32609d6
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/runner2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import inspect

from lnst.Controller import Controller
from lnst.Controller.ContainerPoolManager import ContainerPoolManager
from lnst.Controller.MachineMapper import ContainerMapper
from lnst.Recipes.ENRT.BaseEnrtRecipe import BaseEnrtRecipe

import lnst.Recipes.ENRT as enrt_recipes

podman_uri = "unix:///run/podman/podman.sock"
image_name = "lnst"
ctl = Controller(
poolMgr=ContainerPoolManager,
mapper=ContainerMapper,
podman_uri=podman_uri,
image=image_name,
debug=1,
)

params = dict(
perf_tests=['tcp_stream'],
perf_duration=5,
perf_iterations=2,
perf_warmup_duration=0,
ping_count=1,
perf_test_simulation=True,
)

for recipe_name in dir(enrt_recipes):
if recipe_name in ["BaseEnrtRecipe", "BaseTunnelRecipe", "BaseLACPRecipe"]:
continue

recipe = getattr(enrt_recipes, recipe_name)

if not (inspect.isclass(recipe) and issubclass(recipe, BaseEnrtRecipe)):
continue

if "Bond" in recipe_name:
params = params.copy()
params["bonding_mode"] = "active-backup"
params["miimon_value"] = 5

recipe_instance = recipe(**params)

ctl.run(recipe_instance)

overall_result = all([run.overall_result for run in recipe_instance.runs])

56 changes: 56 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,62 @@ jobs:
venv_path=$(poetry env info -p)
sudo "$venv_path"/bin/python3 .github/runner.py
ENRTTest:
runs-on: ubuntu-24.04

steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Source branch checkout
uses: actions/checkout@v2

- name: Set up system requirements
run: |
sudo apt-get update
sudo apt-get install podman -y
sudo systemctl enable --now podman.socket
curl -sSL https://install.python-poetry.org | python3 - --version 1.3.1
- name: Set up Podman network requirements
run: |
sudo sysctl -w net.ipv4.ip_forward=1
sudo sysctl net.ipv4.conf.all.forwarding=1
sudo iptables -P FORWARD ACCEPT
sudo sysctl -p
- name: Install LNST
run: |
sudo apt-get install -y iputils-* \
ethtool \
gcc \
python-dev \
libxml2-dev \
libxslt-dev \
qemu-kvm \
libvirt-daemon-system \
libvirt-clients \
bridge-utils \
libvirt-dev \
libnl-3-200 \
libnl-route-3-dev \
git \
libnl-3-dev
export PATH="/root/.local/bin:$PATH"
poetry install -E "containers"
- name: Build LNST agents image
run: |
sudo -E XDG_RUNTIME_DIR= podman build . -t lnst -f container_files/Dockerfile
- name: All ENRT recipes test
run: |
export PATH="/root/.local/bin:$PATH"
venv_path=$(poetry env info -p)
sudo "$venv_path"/bin/python3 .github/runner2.py
ImportsCheck:
runs-on: ubuntu-20.04
steps:
Expand Down

0 comments on commit 32609d6

Please sign in to comment.