Create a containerized test suite for glb-director#186
Open
mpenny-github wants to merge 16 commits into
Open
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…run on arm64 hosts. Pin to a specific focal version to harden security
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a containerized way to run the existing glb-director test suites (locally and in GitHub Actions) as part of the Noble enablement effort, and updates several Python/Scapy-based tests to be Python 3 compatible while conditionally skipping tests that require Vagrant-only infrastructure or host kernel features.
Changes:
- Added a new GitHub Actions workflow to build a Docker test image and run multiple glb-* test suites inside containers.
- Added a
script/test-localhelper to run the same containerized suites locally across distros. - Ported/adjusted multiple Python tests and helpers for Python 3, including adding targeted skip logic for non-container-compatible tests.
Show a summary per file
| File | Description |
|---|---|
| src/scapy-glb-gue/glb_scapy/glb_gue_scapy.py | Fixes Python 3 integer division for Scapy field length calculation. |
| src/scapy-glb-gue/glb_scapy/init.py | Switches to relative import for package correctness. |
| src/glb-redirect/tests/test_glb_redirect_v6_on_v4.py | Updates print usage for Python 3. |
| src/glb-redirect/tests/test_glb_redirect_v4_on_v4.py | Updates print usage for Python 3. |
| src/glb-redirect/tests/glb_test_utils.py | Adds Vagrant-network reachability probe and SkipTest gating. |
| src/glb-redirect/tests/glb_test_remote_snoop.py | Minor Python 3 print adjustment in debug logging. |
| src/glb-healthcheck/test/test-basic.sh | Adds conditional skipping when Vagrant backends are unreachable; switches to python3 -m http.server. |
| src/glb-healthcheck/test/lib.sh | Adds shell-level SKIPPED reporting + backend reachability probe + loopback IP binding for container runs. |
| src/glb-director/tests/test-config.json | Reorders JSON keys/formatting (no semantic change intended). |
| src/glb-director/tests/test_rendezvous_table.py | Updates hex encode/decode helpers for Python 3. |
| src/glb-director/tests/test_director_classify_v6.py | Updates print usage for Python 3. |
| src/glb-director/tests/test_cli_tool.py | Updates hex/bytes handling and map->list usage for Python 3. |
| src/glb-director/tests/pcap_tests.sh | Adds skipping when hugepages are unavailable (common in containers). |
| src/glb-director/tests/lib/testlib.sh | Adds shell-level SKIPPED reporting and hugepage availability probe. |
| src/glb-director/tests/glb_test_utils.py | Python 3 compatibility updates + SkipTest gating for missing kernel capabilities; improves teardown robustness. |
| script/test-local | New local helper script to build images and run suites in Docker. |
| script/helpers/folding.sh | Updates folding output to GitHub Actions group/endgroup format. |
| script/Dockerfile.focal | Adds Python 3 deps + requirements install + GOFLAGS buildvcs workaround + extra test deps (valgrind/jq/tcpdump). |
| script/cibuild-create-packages-focal | Removes focal-specific wrapper in favor of a parameterized script. |
| script/cibuild-create-packages | Generalizes package-build script to accept a distro argument and matching Dockerfile. |
| .github/workflows/test.yml | New workflow to build Docker images once and run test suites in containers. |
| .github/workflows/ci.yml | Updates package build job to use a distro matrix and renamed artifacts. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
src/glb-director/tests/glb_test_utils.py:257
- Same tuple-printing issue here:
print(('launched as pid', self.director.pid))will print a tuple, not a friendly message. Preferprint('launched as pid', self.director.pid)/ f-string formatting.
stdout=open('director-output.txt', 'ab'),
stderr=subprocess.STDOUT,
env=notify_director.updated_env(),
)
print(('launched as pid', self.director.pid))
src/glb-director/tests/glb_test_utils.py:484
print(('Waiting for packets on', iface_name, 'with timeout', timeout_seconds))prints a single tuple, which is noisy and harder to read in test logs. Useprint('Waiting for packets on', iface_name, 'with timeout', timeout_seconds)(or a formatted string) so each part is a proper print argument.
def wait_for_packet(self, iface, condition, timeout_seconds=5):
# Newer scapy L2ListenSocket no longer exposes `.iff`; fall back to
# `.iface` and finally repr() so the print never crashes the test.
iface_name = getattr(iface, 'iff', None) or getattr(iface, 'iface', None) or repr(iface)
print(('Waiting for packets on', iface_name, 'with timeout', timeout_seconds))
try:
- Files reviewed: 22/22 changed files
- Comments generated: 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the second PR in a series to enable glb-director to run on ubuntu noble.
Previous PR: #185
This PR creates a new github action and a local script that runs the existing test suite from vagrant in a docker container. Some of the tests can't function in a containerized environment and have to be skipped.
In preperation for running this on ubuntu noble, I've update the python test framework to run on python3 rather than python2.