Skip to content

Testing Strategy and CI/CD

Relevant source files

The following files were used as context for generating this wiki page:

The eCapture project employs a multi-layered testing strategy to ensure the reliability of eBPF-based capture across diverse Linux kernels and architectures. This strategy spans from local Go unit tests for userspace logic to comprehensive End-to-End (E2E) tests running on real hardware/virtualized kernels, integrated into a robust GitHub Actions CI/CD pipeline.

1. Testing Layers

1.1 Go Unit Tests

Unit tests focus on the userspace control plane and event processing logic. These tests do not require root privileges or eBPF capabilities as they use mocked data or recorded event streams.

1.2 End-to-End (E2E) Tests

E2E tests are the core of eCapture's validation. They run on real Linux environments and execute actual captures against target applications.

1.3 Security and Quality Scans

2. CI/CD Architecture

The CI/CD system is built on GitHub Actions, automating the build, test, and release cycles for multiple architectures (x86_64 and arm64).

Build and Test Pipeline Data Flow

This diagram illustrates the flow from a Pull Request to a verified build artifact.

Diagram: PR Validation and E2E Pipeline

Sources: .github/workflows/e2e.yml:1-22, .github/workflows/pr_build_debug.yml:1-22, .github/workflows/codeql-analysis.yml:12-35

Multi-Arch Build Strategy

eCapture uses a matrix strategy to build for both Linux and Android across different CPU architectures.

Target OSArchitectureToolchainArtifact Type
Linuxamd64Clang-14 / GCCBinary / RPM / DEB
Linuxarm64aarch64-linux-gnu-gccBinary / RPM / DEB
Androidarm64Android NDKBinary

Sources: .github/workflows/pr_build_debug.yml:19-22, .github/workflows/pr_build_debug.yml:33-60

3. Implementation Details

3.1 E2E Test Framework

The E2E tests are orchestrated via Bash scripts that manage the lifecycle of the eCapture process and the target client.

3.2 Automated Release Pipeline

When a tag is pushed, the builder/Makefile.release is invoked to create production-ready binaries.

  1. Environment Prep: Installs llvm, clang, and linux-source .github/workflows/pr_build_debug.yml:33-47.
  2. Compilation: Runs make release which compiles both CO-RE and non-CO-RE versions .github/workflows/pr_build_debug.yml:67-75.
  3. Packaging: Bundles binaries into .tar.gz and generates checksums.

Diagram: Event Processor Unit Test Data Flow

Sources: pkg/event_processor/processor_test.go:44-77, pkg/event_processor/base_event.go:76-87

4. Key Testing Files

File PathPurpose
.github/workflows/e2e.ymlMain GitHub Actions workflow for E2E testing.
test/e2e/common.shUtility functions for shell-based E2E tests.
pkg/event_processor/processor_test.goUnit tests for the userspace event pipeline.
.github/workflows/pr_build_debug.ymlCross-platform build verification for PRs.
test/e2e/tls_text_advanced_test.shAdvanced scenarios (HTTP/2, PID/UID filtering).

Sources: .github/workflows/e2e.yml:1-22, test/e2e/common.sh:1-12, pkg/event_processor/processor_test.go:1-30, test/e2e/tls_text_advanced_test.sh:1-15

Testing Strategy and CI/CD has loaded