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..a4c0dda 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/status_test.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"