From 3ac3d2b07e4cf8b8a3d1b14b83b168dc35683dc6 Mon Sep 17 00:00:00 2001 From: Matthew McPherrin Date: Thu, 16 Nov 2023 00:57:33 -0500 Subject: [PATCH] Integration test --- .github/workflows/integration.yaml | 27 +++++++++++++++++++++++++++ integration_test.go | 17 +++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/integration.yaml create mode 100644 integration_test.go diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml new file mode 100644 index 0000000..0e3782a --- /dev/null +++ b/.github/workflows/integration.yaml @@ -0,0 +1,27 @@ +--- +name: integration + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + integration: + runs-on: [ubuntu-latest] + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: "1.21.x" + - name: checkout + uses: actions/checkout@v4 + - name: Start containers + run: docker compose up --build --detach + - name: run integration test + run: go test --tags=integration + - name: Stop containers + if: always() + run: docker compose down diff --git a/integration_test.go b/integration_test.go new file mode 100644 index 0000000..f5d2b2c --- /dev/null +++ b/integration_test.go @@ -0,0 +1,17 @@ +//go:build integration + +package main + +// TestIntegration checks that unbound_exporter is running, successfully +// scraping and exporting metrics. +// +// It assumes unbound_exporter is available on localhost:9167, and Unbound on +// localhost:1053, as is set up in the docker-compose.yml file. +// +// A typical invocation of this test would look like +// docker compose up --build -d +// go test --tags=integration +// docker compose down +func TestIntegration(t *testing.T) { + // TODO +}