mirror of https://github.com/statping/statping
docker cypress testing image
parent
d59f7f85af
commit
df98c36853
|
@ -14,9 +14,11 @@ assets
|
|||
*.log
|
||||
.env
|
||||
logs
|
||||
dev/test/node_modules
|
||||
/dev/test/node_modules
|
||||
dev/test/cypress/videos
|
||||
dev/test/cypress/screenshots
|
||||
dev/test/app
|
||||
source/rice-box.go
|
||||
sass
|
||||
.DS_Store
|
||||
source/css/base.css.map
|
||||
|
|
20
Makefile
20
Makefile
|
@ -83,10 +83,10 @@ docker-push-latest: docker
|
|||
docker-run-dev: docker-dev
|
||||
docker run -t -p 8080:8080 hunterlong/statup:dev
|
||||
|
||||
docker-test: docker-dev clean
|
||||
docker build -t hunterlong/statup:test -f dev/Dockerfile-test .
|
||||
docker-cypress: clean
|
||||
docker build -t hunterlong/statup:test -f dev/Dockerfile-cypress .
|
||||
|
||||
docker-run-test: docker-test
|
||||
docker-run-cypress: docker-cypress
|
||||
docker run -t -p 8080:8080 --entrypoint "go test -v -p=1 $(BUILDVERSION) ./..." hunterlong/statup:test
|
||||
|
||||
docker-base: clean
|
||||
|
@ -124,13 +124,13 @@ dev-deps: dep
|
|||
|
||||
clean:
|
||||
rm -rf ./{logs,assets,plugins,statup.db,config.yml,.sass-cache,config.yml,statup,build}
|
||||
rm -rf cmd/{logs,assets,plugins,statup.db,config.yml,.sass-cache}
|
||||
rm -rf core/{logs,assets,plugins,statup.db,config.yml,.sass-cache}
|
||||
rm -rf handlers/{logs,assets,plugins,statup.db,config.yml,.sass-cache}
|
||||
rm -rf notifiers/{logs,assets,plugins,statup.db,config.yml,.sass-cache}
|
||||
rm -rf source/{logs,assets,plugins,statup.db,config.yml,.sass-cache}
|
||||
rm -rf types/{logs,assets,plugins,statup.db,config.yml,.sass-cache}
|
||||
rm -rf utils/{logs,assets,plugins,statup.db,config.yml,.sass-cache}
|
||||
rm -rf cmd/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log}
|
||||
rm -rf core/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log}
|
||||
rm -rf handlers/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log}
|
||||
rm -rf notifiers/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log}
|
||||
rm -rf source/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log}
|
||||
rm -rf types/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log}
|
||||
rm -rf utils/{logs,assets,plugins,statup.db,config.yml,.sass-cache,*.log}
|
||||
rm -rf dev/test/cypress/videos
|
||||
rm -rf .sass-cache
|
||||
rm -f coverage.out
|
||||
|
|
|
@ -146,7 +146,7 @@ func TestCountOnline(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCreateService(t *testing.T) {
|
||||
s := &Service{Service: &types.Service{
|
||||
s := &Service{&types.Service{
|
||||
Name: "That'll do 🐢",
|
||||
Domain: "https://www.youtube.com/watch?v=rjQtzV9IZ0Q",
|
||||
ExpectedStatus: 200,
|
||||
|
@ -170,7 +170,7 @@ func TestViewNewService(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCreateFailingHTTPService(t *testing.T) {
|
||||
s := &Service{Service: &types.Service{
|
||||
s := &Service{&types.Service{
|
||||
Name: "Bad URL",
|
||||
Domain: "http://localhost/iamnothere",
|
||||
ExpectedStatus: 200,
|
||||
|
@ -195,7 +195,7 @@ func TestServiceFailedCheck(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestCreateFailingTCPService(t *testing.T) {
|
||||
s := &Service{Service: &types.Service{
|
||||
s := &Service{&types.Service{
|
||||
Name: "Bad TCP",
|
||||
Domain: "localhost",
|
||||
Port: 5050,
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
FROM cypress/browsers:chrome67
|
||||
MAINTAINER "Hunter Long (https://github.com/hunterlong)"
|
||||
# Statup 'test' image for running a full test using the production environment
|
||||
|
||||
WORKDIR $HOME/statup
|
||||
ADD dev/test .
|
||||
|
||||
ENV VERSION=v0.46
|
||||
|
||||
RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-alpine.tar.gz && \
|
||||
tar -xvzf statup-linux-alpine.tar.gz && \
|
||||
chmod +x statup && \
|
||||
mv statup /usr/local/bin/statup
|
||||
|
||||
RUN npm install node-sass
|
||||
ENV SASS=node-sass
|
||||
RUN npm install
|
||||
RUN npm run test-docker
|
|
@ -1,23 +0,0 @@
|
|||
FROM golang:1.10.3-alpine
|
||||
MAINTAINER "Hunter Long (https://github.com/hunterlong)"
|
||||
# Statup 'test' image for running a full test using the production environment
|
||||
|
||||
RUN apk add --no-cache libstdc++ gcc g++ make git ca-certificates linux-headers wget curl
|
||||
|
||||
RUN curl -L -s https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 -o /go/bin/dep && \
|
||||
chmod +x /go/bin/dep
|
||||
|
||||
RUN curl -L -s https://assets.statup.io/sass -o /usr/local/bin/sass && \
|
||||
chmod +x /usr/local/bin/sass
|
||||
|
||||
WORKDIR /go/src/github.com/hunterlong/statup
|
||||
ADD . /go/src/github.com/hunterlong/statup
|
||||
|
||||
ENV VERSION=$(VERSION)
|
||||
ENV IS_DOCKER=true
|
||||
|
||||
RUN make dev-deps
|
||||
RUN make install
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT make test
|
|
@ -14,6 +14,7 @@
|
|||
"cy:run-video": "cypress run --record --key $CYPRESS_KEY",
|
||||
"cy:run": "cypress run",
|
||||
"test": "bash -c \"./test.sh\"",
|
||||
"test-docker": "bash -c \"./test-docker.sh\"",
|
||||
"testnovid": "cypress run",
|
||||
"open": "cypress open"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
statup > /dev/null &
|
||||
|
||||
./node_modules/.bin/start-server-and-test start http://localhost:8080/robots.txt cy:run
|
|
@ -23,7 +23,6 @@ import (
|
|||
"github.com/hunterlong/statup/source"
|
||||
"github.com/hunterlong/statup/utils"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -89,9 +88,6 @@ func Router() *mux.Router {
|
|||
r.Handle("/api/users", http.HandlerFunc(ApiAllUsersHandler))
|
||||
r.Handle("/api/users/{id}", http.HandlerFunc(ApiUserHandler))
|
||||
r.Handle("/metrics", http.HandlerFunc(PrometheusHandler))
|
||||
if os.Getenv("GO_ENV") == "test" {
|
||||
r.Handle("/reset", http.HandlerFunc(ResetDbHandler))
|
||||
}
|
||||
r.NotFoundHandler = http.HandlerFunc(Error404Handler)
|
||||
return r
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/hunterlong/statup/core"
|
||||
"github.com/hunterlong/statup/types"
|
||||
"github.com/hunterlong/statup/utils"
|
||||
|
@ -88,9 +89,11 @@ func ProcessSetupHandler(w http.ResponseWriter, r *http.Request) {
|
|||
Password: password,
|
||||
Email: email,
|
||||
Error: nil,
|
||||
Location: ".",
|
||||
Location: utils.Directory,
|
||||
}}
|
||||
|
||||
fmt.Println(config)
|
||||
|
||||
err := config.Save()
|
||||
if err != nil {
|
||||
utils.Log(4, err)
|
||||
|
|
Loading…
Reference in New Issue