Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e0785c1
Use matrix with parametrized ci.yaml for future os upgrades
mpenny-github May 19, 2026
4a524ec
Potential fix for pull request finding
mpenny-github May 19, 2026
aaf989c
Enfore that the docker container should use amd64 version (even when …
mpenny-github May 19, 2026
ab35fa7
Create containerized testing framework
mpenny-github May 19, 2026
3bbf390
Update the Dockerfile with the requirements for running in a container
mpenny-github May 19, 2026
e2fb5d3
Update python tests with python3 syntax
mpenny-github May 19, 2026
0225418
Add tcpdump to Dockerfile. Skip tests that can't be run locally
mpenny-github May 19, 2026
443be59
Resolve: ValueError: must have exactly one of create/read/write/appen…
mpenny-github May 19, 2026
0c1cb03
Add goflags for builds. Skip tests that can't be run outside vagrant
mpenny-github May 19, 2026
eea8fe2
Debug director-xdp failure
mpenny-github May 19, 2026
91a8672
Use the renamed L2ListenSocket object. Ensure that XDP program is det…
mpenny-github May 19, 2026
23a51d6
Use HOSTPATH
mpenny-github May 19, 2026
75e859a
Improve glb-director teardown when run on action
mpenny-github May 19, 2026
1335bc6
Remove the test file that is not needed. Handle scapy teardown better
mpenny-github May 19, 2026
85f5c95
Remove dpdk-rte-kni-dkms
mpenny-github May 19, 2026
419c02f
Improvements from copilot
mpenny-github May 20, 2026
ccdfa21
Add build artifacts to .gitignore, better handling in glb_test_util.py
mpenny-github May 26, 2026
41ee404
Add pytest.ini for glb-redirect
mpenny-github May 27, 2026
9181172
Remove usused import. Write to devnull to avoid deadlock
mpenny-github May 27, 2026
e2f5a7b
Remove pytest file. Wrong branch
mpenny-github May 28, 2026
6bd4674
Only kill the process if it hasn't stopped already
mpenny-github May 28, 2026
ac839a9
Merge remote-tracking branch 'origin/master' into containerized_test_…
mpenny-github May 28, 2026
8dc2745
Resolve merge conflict
mpenny-github May 28, 2026
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
73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Tests

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
workflow_dispatch:

permissions:
contents: read

jobs:
build-images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
distro: [focal]
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build image
run: |
docker build --file script/Dockerfile.${{ matrix.distro }} --tag glb-director-build-${{ matrix.distro }}:latest .
docker save glb-director-build-${{ matrix.distro }}:latest --output glb-director-build-${{ matrix.distro }}.tar

- name: Upload image artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.distro }}
path: glb-director-build-${{ matrix.distro }}.tar
retention-days: 1



test:
needs: build-images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-suite: [director, director-xdp, healthcheck, redirect]
distro: [focal]
steps:
- name: Checkout code
uses: actions/checkout@v6

- name: Download image artifact
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.distro }}

- name: Load Docker image
run: |
docker load --input glb-director-build-${{ matrix.distro }}.tar

- name: Run test suite in container
run: |
docker run --rm \
--privileged \
--volume $(pwd):/workspace \
--workdir /workspace \
glb-director-build-${{ matrix.distro }}:latest \
bash -c "cd /workspace/src/glb-${{ matrix.test-suite }} && script/test"
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ src/glb-redirect/*/*.mod
*.symvers
*.order
*.deb
*.bin

# Runtime artifacts produced by script/test-local / the test suites
src/glb-director/director-output.txt
src/glb-director/cli/test-check-config
src/glb-director/tests/director-config.json
src/glb-director/tests/test-tables.json
src/glb-director-xdp/glb-director-xdp
src/glb-healthcheck/reload.txt
src/glb-healthcheck/log/*
18 changes: 17 additions & 1 deletion script/Dockerfile.focal
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ RUN wget --quiet https://golang.org/dl/go1.24.5.linux-amd64.tar.gz -O- | tar -C
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"
# Disable VCS stamping in Go 1.24+ builds. The repo is bind-mounted from the
# host so git refuses to operate on it inside the container ("dubious
# ownership"), which causes `go build` to fail with
# "error obtaining VCS status: exit status 128".
ENV GOFLAGS=-buildvcs=false

# fpm for packaging
RUN apt-get update && apt-get install -y ruby ruby-dev rubygems build-essential
Expand All @@ -30,11 +35,22 @@ RUN gem install rake fpm
# XDP
# linux-libc-dev must be upgraded to get a bpf.h that matches what we use. the rest match what we do in Vagrant for testing.
RUN apt-get update && apt install -y apt-transport-https curl software-properties-common
RUN apt-get update && apt install -y iproute2 libbpf-dev linux-libc-dev clang-10
RUN apt-get update && apt install -y iproute2 libbpf-dev linux-libc-dev clang-10 clang-tools-10

# Hack because the kernel headers are not installed in the right place (linuxkit vs generic)
RUN ln -s /usr/src/$(ls /usr/src/ | grep generic) /usr/src/linux-headers-$(uname -r)

# Hack for C99 math
RUN sed -i '1s/^/#define __USE_C99_MATH\n/' /usr/src/$(ls /usr/src/ | grep generic)/include/linux/kasan-checks.h
RUN sed -i '2s/^/#include <stdbool.h>\n/' /usr/src/$(ls /usr/src/ | grep generic)/include/linux/kasan-checks.h

# Python test dependencies (scapy/nose etc.) used by the test suites.
RUN apt-get update && apt-get install -y python3 python3-pip python3-dev
COPY requirements.txt /tmp/requirements.txt
RUN pip3 install --no-cache-dir -r /tmp/requirements.txt

# valgrind is required by the glb-director test suite
RUN apt-get update && apt-get install -y valgrind

# netcat and jq are required by the glb-healthcheck test suite
RUN apt-get update && apt-get install -y netcat jq tcpdump
2 changes: 1 addition & 1 deletion script/cibuild-create-packages
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fi

begin_fold "Preparing Docker build environment"
(
docker build -t glb-director-build-$DISTRO -f "$DOCKERFILE" script
docker build -t glb-director-build-$DISTRO -f "$DOCKERFILE" "$HOSTPATH"
)
end_fold

Expand Down
43 changes: 43 additions & 0 deletions script/test-local
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

set -e

DISTRO="${1}"

if [[ -z "$DISTRO" ]]; then
echo "Usage: $0 <distro>"
echo " e.g. $0 focal"
echo " e.g. $0 noble"
exit 1
fi

HOSTPATH=$(cd "$(dirname "$0")/.." && pwd)
IMAGE="glb-director-build-${DISTRO}:latest"
DOCKERFILE="script/Dockerfile.${DISTRO}"

if [[ ! -f "${HOSTPATH}/${DOCKERFILE}" ]]; then
echo "ERROR: Dockerfile not found: ${DOCKERFILE}"
exit 1
fi

cd "$HOSTPATH"

echo "==> Building Docker image for ${DISTRO}..."
docker build --platform linux/amd64 --file "${DOCKERFILE}" --tag "${IMAGE}" .

TEST_SUITES=(director director-xdp healthcheck redirect)

for suite in "${TEST_SUITES[@]}"; do
echo ""
echo "==> Running test suite: glb-${suite} (${DISTRO})"
docker run --rm \
--platform linux/amd64 \
--privileged \
--volume "$(pwd):/workspace" \
--workdir /workspace \
"${IMAGE}" \
bash -c "cd /workspace/src/glb-${suite} && script/test"
done

echo ""
echo "==> All test suites passed for ${DISTRO}."
Loading
Loading