Skip to content

Commit

Permalink
fixing test for NoError
Browse files Browse the repository at this point in the history
closes #325
  • Loading branch information
jrxFive authored and sparrc committed Oct 27, 2015
1 parent 0d31f40 commit e622bd5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 66 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand All @@ -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
34 changes: 25 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion outputs/nsq/nsq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
54 changes: 0 additions & 54 deletions scripts/docker-compose.yml

This file was deleted.

0 comments on commit e622bd5

Please sign in to comment.