Skip to content

Commit

Permalink
[cmd/opampsupervisor] Add integration/E2E tests (#27002)
Browse files Browse the repository at this point in the history
**Description:**

Add tests that verify the Supervisor's behavior using a real Collector
binary against an OpAMP server written with the opamp-go library. This
tests a basic set of functionality mostly based on what is currently
listed as implemented in the Supervisor's feature table.

Right now these tests start the Supervisor using the Go API to avoid
process handling, but could be changed to start it through a binary in
the future. I've placed these tests in the E2E testing workflow even
though they run fairly quickly since they depend on a built Collector
binary, may become more expansive in the future, and don't fit in any of
the existing jobs in the `build-and-test` workflow. I'm open to placing
them in another location if we'd prefer them elsewhere.

This also updates opamp-go to v0.9.0 to take advantage of
open-telemetry/opamp-go#200.

**Link to tracking Issue:**

Resolves
#24292
  • Loading branch information
evan-bradley authored Dec 12, 2023
1 parent 7640dc9 commit 411c707
Show file tree
Hide file tree
Showing 11 changed files with 513 additions and 2 deletions.
68 changes: 67 additions & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
# We limit cache download as a whole to 5 minutes.
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
jobs:
docker-build:
collector-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -33,6 +33,40 @@ jobs:
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Build Collector
run: make otelcontribcol
- name: Upload Collector Binary
uses: actions/upload-artifact@v3
with:
name: collector-binary
path: ./bin/*
docker-build:
runs-on: ubuntu-latest
needs: collector-build
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ~1.20.8
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v3
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Download Collector Binary
uses: actions/download-artifact@v3
with:
name: collector-binary
path: bin/
- name: Build Docker Image
run: |
make docker-otelcontribcol
Expand Down Expand Up @@ -107,3 +141,35 @@ jobs:
run: |
cd receiver/k8sobjectsreceiver
go test -v --tags=e2e
supervisor-test:
runs-on: ubuntu-latest
needs: collector-build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ~1.20.8
cache: false
- name: Cache Go
id: go-cache
timeout-minutes: 5
uses: actions/cache@v3
with:
path: |
~/go/bin
~/go/pkg/mod
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Download Collector Binary
uses: actions/download-artifact@v3
with:
name: collector-binary
path: bin/
- run: chmod +x bin/*
- name: Run opampsupervisor e2e tests
run: |
cd cmd/opampsupervisor
go test -v --tags=e2e
4 changes: 4 additions & 0 deletions cmd/opampsupervisor/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include ../../Makefile.Common

e2e-test:
make -C ../../ otelcontribcol
go test -v --tags=e2e .
Loading

0 comments on commit 411c707

Please sign in to comment.