Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

Commit

Permalink
Travis: Execute acceptance tests on dockerized RMQ.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilgdn committed Jan 6, 2020
1 parent ab3447b commit 2a4352d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ language: go
go:
- "1.13.x"

env:
global:
- GOFLAGS=-mod=vendor GO111MODULE=on
- RABBITMQ_ENDPOINT="http://127.0.0.1:15672"
- RABBITMQ_USERNAME="guest"
- RABBITMQ_PASSWORD="guest"
jobs:
- RABBITMQ_VERSION=3.8
- RABBITMQ_VERSION=3.7
- RABBITMQ_VERSION=3.6

install:
# This script is used by the Travis build to install a cookie for
# go.googlesource.com so rate limits are higher when using `go get` to fetch
Expand All @@ -17,13 +28,18 @@ script:
- make test
- make vet
- make website-test
- docker-compose -f $(pwd)/scripts/docker-compose.yml up -d
- $(pwd)/scripts/wait-rabbitmq-docker.sh $(pwd)/scripts/docker-compose.yml
- make testacc
- docker-compose -f $(pwd)/scripts/docker-compose.yml down


branches:
only:
- master
- travis

matrix:
fast_finish: true
allow_failures:
- go: tip
env:
- GOFLAGS=-mod=vendor GO111MODULE=on
7 changes: 7 additions & 0 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3"

services:
rabbitmq:
image: rabbitmq:${RABBITMQ_VERSION:-3.8}-management-alpine
ports:
- 15672:15672
24 changes: 24 additions & 0 deletions scripts/wait-rabbitmq-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

COMPOSE_FILE=${1:-"docker-compose.yml"}

TIMEOUT=30

if [ ! -e "$COMPOSE_FILE" ]; then
echo "Unable to find docker-compose file: $COMPOSE_FILE"
exit 1
fi

echo "Waiting for RabbitMQ to be up"
i=0
until curl -s http://localhost:15672/api > /dev/null; do
i=$((i + 1))
if [ $i -eq $TIMEOUT ]; then
echo
echo "Timeout while waiting for RabbitMQ to be up"
exit 1
fi
printf "."
sleep 2
done

0 comments on commit 2a4352d

Please sign in to comment.