Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Browning committed Apr 14, 2021
1 parent e234408 commit 92dc8a1
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ jobs:
access_token: ${{ secrets.GITHUB_TOKEN }}
all_but_latest: true # can cancel workflows scheduled later

test-integration-amqp:
name: Integration - Linux, Amqp
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: make ci-sweep
- uses: actions/[email protected]
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: sudo bash scripts/environment/bootstrap-ubuntu-20.04.sh
- run: bash scripts/environment/prepare.sh
- run: echo "::add-matcher::.github/matchers/rust.json"
- run: make slim-builds
- run: make test-integration-amqp

test-integration-aws:
name: Integration - Linux, AWS
runs-on: ubuntu-20.04
Expand Down
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,24 @@ test-behavior: ## Runs behaviorial test

.PHONY: test-integration
test-integration: ## Runs all integration tests
test-integration: test-integration-aws test-integration-clickhouse test-integration-docker-logs test-integration-elasticsearch
test-integration: test-integration-gcp test-integration-humio test-integration-influxdb test-integration-kafka
test-integration: test-integration-loki test-integration-mongodb_metrics test-integration-nats
test-integration: test-integration-amqp test-integration-aws test-integration-clickhouse test-integration-docker-logs
test-integration: test-integration-elasticsearch test-integration-gcp test-integration-humio test-integration-influxdb
test-integration: test-integration-kafka test-integration-loki test-integration-mongodb_metrics test-integration-nats
test-integration: test-integration-nginx test-integration-postgresql_metrics test-integration-prometheus test-integration-pulsar
test-integration: test-integration-splunk

.PHONY: test-integration-amqp
test-integration-amqp: ## Runs Kafka integration tests
ifeq ($(AUTOSPAWN), true)
@scripts/setup_integration_env.sh amqp stop
@scripts/setup_integration_env.sh amqp start
sleep 10 # Many services are very slow... Give them a sec..
endif
${MAYBE_ENVIRONMENT_EXEC} cargo test --no-fail-fast --no-default-features --features "amqp-integration-tests" --lib ::amqp:: -- --nocapture
ifeq ($(AUTODESPAWN), true)
@scripts/setup_integration_env.sh amqp stop
endif

.PHONY: test-integration-aws
test-integration-aws: ## Runs AWS integration tests
ifeq ($(AUTOSPAWN), true)
Expand Down
43 changes: 43 additions & 0 deletions scripts/setup_integration/amqp_integration_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -o pipefail

# amqp_integration_env.sh
#
# SUMMARY
#
# Builds and pulls down the Vector Amqp Integration test environment

if [ $# -ne 1 ]
then
echo "Usage: $0 {stop|start}" 1>&2; exit 1;
exit 1
fi
ACTION=$1

#
# Functions
#

start_podman () {
podman pod create --replace --name vector-test-integration-amqp -p 5672:5672
podman run -d --pod=vector-test-integration-amqp --name vector_amqp rabbitmq:3.8
}

start_docker () {
docker network create vector-test-integration-amqp
docker run -d --network=vector-test-integration-amqp -p 5672:5672 --name vector_amqp rabbitmq:3.8
}

stop_podman () {
podman pod stop vector-test-integration-amqp 2>/dev/null; true
podman pod rm --force vector-test-integration-amqp 2>/dev/null; true
}

stop_docker () {
docker rm --force vector_amqp vector_amqp 2>/dev/null; true
docker network rm vector-test-integration-amqp 2>/dev/null; true
}

echo "Running $ACTION action for Amqp integration tests environment"

"${ACTION}"_"${CONTAINER_TOOL}"

0 comments on commit 92dc8a1

Please sign in to comment.