Merge pull request #88 from appleboy/docker
Fixed #87 Rewrite docker testing.
This commit is contained in:
commit
c1a38daab1
|
@ -1,16 +0,0 @@
|
||||||
FROM golang:1.6.2-alpine
|
|
||||||
|
|
||||||
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
|
||||||
|
|
||||||
RUN apk update \
|
|
||||||
&& apk add git make && rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
# install glide package management.
|
|
||||||
RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install
|
|
||||||
RUN mkdir -p $GOPATH/src/github.com/appleboy/gorush
|
|
||||||
RUN git clone https://github.com/appleboy/gorush.git $GOPATH/src/github.com/appleboy/gorush/
|
|
||||||
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
|
||||||
RUN sed -i"" -e "s/localhost/redis/g" config/config.yml
|
|
||||||
RUN sed -i"" -e "s/localhost/redis/g" gorush/status_test.go
|
|
||||||
RUN sed -i"" -e "s/localhost/redis/g" storage/redis/redis_test.go
|
|
||||||
RUN make bundle
|
|
|
@ -1,14 +1,15 @@
|
||||||
gorush:
|
gorush:
|
||||||
build: "."
|
build: ./golang
|
||||||
dockerfile: Dockerfile.testing
|
|
||||||
links:
|
links:
|
||||||
- redis
|
- redis
|
||||||
privileged: true
|
privileged: true
|
||||||
environment:
|
environment:
|
||||||
- ANDROID_API_KEY
|
- ANDROID_API_KEY
|
||||||
- ANDROID_TEST_TOKEN
|
- ANDROID_TEST_TOKEN
|
||||||
command: /bin/sh -c "make test"
|
volumes:
|
||||||
|
- ../:/go/src/github.com/appleboy/gorush
|
||||||
|
command: /bin/sh -c './docker/testing.sh'
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
build: ./redis
|
||||||
privileged: true
|
privileged: true
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
FROM golang:1.6.2-alpine
|
||||||
|
|
||||||
|
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
||||||
|
|
||||||
|
RUN apk update \
|
||||||
|
&& apk add git make && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
# install glide package management.
|
||||||
|
RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install
|
||||||
|
|
||||||
|
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
|
@ -0,0 +1,7 @@
|
||||||
|
FROM redis:alpine
|
||||||
|
|
||||||
|
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
||||||
|
|
||||||
|
CMD [ "redis-server" ]
|
||||||
|
|
||||||
|
EXPOSE 6379
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
cd /go/src/github.com/appleboy/gorush
|
||||||
|
sed -i"" -e "s/localhost/redis/g" config/config.yml
|
||||||
|
sed -i"" -e "s/localhost/redis/g" gorush/status_test.go
|
||||||
|
sed -i"" -e "s/localhost/redis/g" storage/redis/redis_test.go
|
||||||
|
make bundle && make test
|
|
@ -21,7 +21,11 @@ func initTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrintGoRushVersion(t *testing.T) {
|
func TestPrintGoRushVersion(t *testing.T) {
|
||||||
|
SetVersion("3.0.0")
|
||||||
|
ver := GetVersion()
|
||||||
PrintGoRushVersion()
|
PrintGoRushVersion()
|
||||||
|
|
||||||
|
assert.Equal(t, "3.0.0", ver)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRunNormalServer(t *testing.T) {
|
func TestRunNormalServer(t *testing.T) {
|
||||||
|
|
|
@ -12,6 +12,10 @@ func SetVersion(ver string) {
|
||||||
version = ver
|
version = ver
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetVersion() string {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
// PrintGoRushVersion provide print server engine
|
// PrintGoRushVersion provide print server engine
|
||||||
func PrintGoRushVersion() {
|
func PrintGoRushVersion() {
|
||||||
fmt.Printf(`GoRush %s, Compiler: %s %s, Copyright (C) 2016 Bo-Yi Wu, Inc.`,
|
fmt.Printf(`GoRush %s, Compiler: %s %s, Copyright (C) 2016 Bo-Yi Wu, Inc.`,
|
||||||
|
|
Loading…
Reference in New Issue