fixing test for NoError

closes #325
This commit is contained in:
Jonathan Cross 2015-10-27 13:50:16 -04:00 committed by Cameron Sparr
parent 0d31f40e16
commit e622bd5e7f
4 changed files with 28 additions and 66 deletions

View File

@ -250,7 +250,7 @@ a simple mock will suffice.
To execute Telegraf tests follow these simple steps:
- Install docker compose following [these](https://docs.docker.com/compose/install/)
- Install docker following [these](https://docs.docker.com/installation/)
instructions
- execute `make test`
@ -260,5 +260,5 @@ get the IP address.
### Unit test troubleshooting
Try cleaning up your test environment by executing `make test-cleanup` and
Try cleaning up your test environment by executing `make docker-kill` and
re-running

View File

@ -28,25 +28,41 @@ build-linux-bins: prepare
prepare:
go get github.com/tools/godep
docker-compose:
docker-run:
ifeq ($(UNAME), Darwin)
ADVERTISED_HOST=$(shell sh -c 'boot2docker ip || docker-machine ip default') \
docker-compose --file scripts/docker-compose.yml up -d
docker run --name kafka \
-e ADVERTISED_HOST=$(shell sh -c 'boot2docker ip || docker-machine ip default') \
-e ADVERTISED_PORT=9092 \
-p "2181:2181" -p "9092:9092" \
-d spotify/kafka
endif
ifeq ($(UNAME), Linux)
ADVERTISED_HOST=localhost docker-compose --file scripts/docker-compose.yml up -d
docker run --name kafka \
-e ADVERTISED_HOST=localhost \
-e ADVERTISED_PORT=9092 \
-p "2181:2181" -p "9092:9092" \
-d spotify/kafka
endif
docker run --name mysql -p "3306:3306" -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql
docker run --name memcached -p "11211:11211" -d memcached
docker run --name postgres -p "5432:5432" -d postgres
docker run --name rabbitmq -p "15672:15672" -p "5672:5672" -d rabbitmq:3-management
docker run --name opentsdb -p "4242:4242" -d petergrace/opentsdb-docker
docker run --name redis -p "6379:6379" -d redis
docker run --name aerospike -p "3000:3000" -d aerospike
docker run --name nsq -p "4150:4150" -d nsqio/nsq /nsqd
test: test-cleanup prepare docker-compose
docker-kill:
-docker kill nsq aerospike redis opentsdb rabbitmq postgres memcached mysql kafka
-docker rm nsq aerospike redis opentsdb rabbitmq postgres memcached mysql kafka
test: docker-kill prepare docker-run
# Sleeping for kafka leadership election, TSDB setup, etc.
sleep 30
sleep 60
# Setup SUCCESS, running tests
godep go test ./...
test-short: prepare
$(GOBIN)/godep go test -short ./...
test-cleanup:
docker-compose --file scripts/docker-compose.yml kill
.PHONY: test

View File

@ -23,6 +23,6 @@ func TestConnectAndWrite(t *testing.T) {
require.NoError(t, err)
// Verify that we can successfully write data to the NSQ daemon
err = n.Write(testutil.MockBatchPoints())
err = n.Write(testutil.MockBatchPoints().Points())
require.NoError(t, err)
}

View File

@ -1,54 +0,0 @@
mysql:
image: mysql:5.7
ports:
- "3306:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
memcached:
image: memcached
ports:
- "11211:11211"
postgres:
image: postgres
ports:
- "5432:5432"
# advertised host env variable must be set at runtime, ie,
# ADVERTISED_HOST=`boot2docker ip` docker-compose up -d
kafka:
image: spotify/kafka
ports:
- "2181:2181"
- "9092:9092"
environment:
ADVERTISED_HOST:
ADVERTISED_PORT: 9092
rabbitmq:
image: rabbitmq:3-management
hostname: docker_rabbit
ports:
- "15672:15672"
- "5672:5672"
opentsdb:
image: petergrace/opentsdb-docker
ports:
- "4242:4242"
redis:
image: redis
ports:
- "6379:6379"
aerospike:
image: aerospike/aerospike-server
ports:
- "3000:3000"
nsq:
image: nsqio/nsq
ports:
- "4150:4150"