Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENRT: always deconfigure in a finally block #387

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.12"

- 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.4.2

- 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 \
python3-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
Loading