diff --git a/.github/runner2.py b/.github/runner2.py new file mode 100644 index 000000000..b4570d2bd --- /dev/null +++ b/.github/runner2.py @@ -0,0 +1,34 @@ +import inspect + +from lnst.Controller import Controller +from lnst.Controller.ContainerPoolManager import ContainerPoolManager +from lnst.Controller.MachineMapper import ContainerMapper + +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, + network_plugin="cni", +) + +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, BaseRecipe)): + continue + + recipe_instance = recipe() + + ctl.run(recipe_instance) + + overall_result = all([run.overall_result for run in recipe_instance.runs]) + diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 3b685f2c3..46086a683 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -63,6 +63,62 @@ jobs: venv_path=$(poetry env info -p) sudo "$venv_path"/bin/python3 .github/runner.py + FunctionalTest: + runs-on: ubuntu-20.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: