From 0a673bde48695068711170da59214be9103f5a60 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 3 May 2016 20:39:24 +0800 Subject: [PATCH 1/2] fixed #78 docker test error. Signed-off-by: Bo-Yi Wu --- Makefile | 4 +++- docker/Dockerfile.testing | 2 ++ gorush/status_test.go | 46 --------------------------------------- 3 files changed, 5 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index 398a878..d94e559 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,9 @@ docker_build: clean docker_test: @docker build --rm -t $(TEST_IMAGE) -f docker/Dockerfile.testing . - @docker run --rm -e ANDROID_TEST_TOKEN=$(ANDROID_TEST_TOKEN) -e ANDROID_API_KEY=$(ANDROID_API_KEY) $(TEST_IMAGE) sh -c "cd gorush && go test -v" + @docker run --name gorush-redis -d redis + @docker run --rm --link gorush-redis:redis -e ANDROID_TEST_TOKEN=$(ANDROID_TEST_TOKEN) -e ANDROID_API_KEY=$(ANDROID_API_KEY) $(TEST_IMAGE) sh -c "cd gorush && go test -v" + @docker rm -f gorush-redis deploy: ifeq ($(tag),) diff --git a/docker/Dockerfile.testing b/docker/Dockerfile.testing index 85cc97c..4859ed7 100644 --- a/docker/Dockerfile.testing +++ b/docker/Dockerfile.testing @@ -5,4 +5,6 @@ MAINTAINER Bo-Yi Wu RUN mkdir -p /tmp/build Add . /tmp/build/ WORKDIR /tmp/build +RUN sed -i"" -e "s/localhost/redis/g" config/config.yml +RUN sed -i"" -e "s/localhost/redis/g" gorush/*.go RUN go get -v -d -t ./... diff --git a/gorush/status_test.go b/gorush/status_test.go index fd51000..cc79b74 100644 --- a/gorush/status_test.go +++ b/gorush/status_test.go @@ -2,55 +2,9 @@ package gorush import ( "github.com/stretchr/testify/assert" - // "sync/atomic" "testing" ) -// func TestAddTotalCount(t *testing.T) { -// InitAppStatus() -// addTotalCount(1000) - -// val := atomic.LoadInt64(&RushStatus.TotalCount) - -// assert.Equal(t, int64(1000), val) -// } - -// func TestAddIosSuccess(t *testing.T) { -// InitAppStatus() -// addIosSuccess(1000) - -// val := atomic.LoadInt64(&RushStatus.Ios.PushSuccess) - -// assert.Equal(t, int64(1000), val) -// } - -// func TestAddIosError(t *testing.T) { -// InitAppStatus() -// addIosError(1000) - -// val := atomic.LoadInt64(&RushStatus.Ios.PushError) - -// assert.Equal(t, int64(1000), val) -// } - -// func TestAndroidSuccess(t *testing.T) { -// InitAppStatus() -// addAndroidSuccess(1000) - -// val := atomic.LoadInt64(&RushStatus.Android.PushSuccess) - -// assert.Equal(t, int64(1000), val) -// } - -// func TestAddAndroidError(t *testing.T) { -// InitAppStatus() -// addAndroidError(1000) - -// val := atomic.LoadInt64(&RushStatus.Android.PushError) - -// assert.Equal(t, int64(1000), val) -// } - func TestStatForMemoryEngine(t *testing.T) { var val int64 PushConf.Stat.Engine = "memory" From d3f7e70f91dcb841a905ee3a510b8c1ea4ec3416 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 3 May 2016 22:38:29 +0800 Subject: [PATCH 2/2] fix docker testing. Signed-off-by: Bo-Yi Wu --- docker/Dockerfile.testing | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile.testing b/docker/Dockerfile.testing index 4859ed7..a4c0dda 100644 --- a/docker/Dockerfile.testing +++ b/docker/Dockerfile.testing @@ -6,5 +6,5 @@ RUN mkdir -p /tmp/build Add . /tmp/build/ WORKDIR /tmp/build RUN sed -i"" -e "s/localhost/redis/g" config/config.yml -RUN sed -i"" -e "s/localhost/redis/g" gorush/*.go +RUN sed -i"" -e "s/localhost/redis/g" gorush/status_test.go RUN go get -v -d -t ./...