mirror of https://github.com/statping/statping
parent
30aa4e74cf
commit
43aa17c17c
19
Makefile
19
Makefile
|
@ -22,6 +22,8 @@ test-all: dev-deps test cypress-test
|
||||||
|
|
||||||
travis-test: dev-deps cypress-install test docker-test cypress-test coverage
|
travis-test: dev-deps cypress-install test docker-test cypress-test coverage
|
||||||
|
|
||||||
|
docker-publish-all: docker-build-base docker-dev docker docker-push-base docker-push-dev docker-push-latest
|
||||||
|
|
||||||
build: compile
|
build: compile
|
||||||
$(GOBUILD) $(BUILDVERSION) -o $(BINARY_NAME) -v ./cmd
|
$(GOBUILD) $(BUILDVERSION) -o $(BINARY_NAME) -v ./cmd
|
||||||
|
|
||||||
|
@ -75,15 +77,8 @@ docker-dev: clean docker-base
|
||||||
|
|
||||||
docker-push-dev:
|
docker-push-dev:
|
||||||
docker push hunterlong/statup:dev
|
docker push hunterlong/statup:dev
|
||||||
docker tag hunterlong/statup:base hunterlong/statup:base-v$(VERSION)
|
|
||||||
docker push hunterlong/statup:base
|
|
||||||
docker push hunterlong/statup:cypress
|
docker push hunterlong/statup:cypress
|
||||||
|
|
||||||
docker-push-base:
|
|
||||||
docker tag hunterlong/statup:base hunterlong/statup:base-v$(VERSION)
|
|
||||||
docker push hunterlong/statup:base
|
|
||||||
docker push hunterlong/statup:base-v$(VERSION)
|
|
||||||
|
|
||||||
docker-push-latest: docker
|
docker-push-latest: docker
|
||||||
docker push hunterlong/statup:latest
|
docker push hunterlong/statup:latest
|
||||||
|
|
||||||
|
@ -98,13 +93,15 @@ docker-cypress: clean
|
||||||
docker-run-cypress: docker-cypress
|
docker-run-cypress: docker-cypress
|
||||||
docker run -t hunterlong/statup:cypress
|
docker run -t hunterlong/statup:cypress
|
||||||
|
|
||||||
docker-base: clean
|
docker-push-base:
|
||||||
|
docker tag hunterlong/statup:base hunterlong/statup:base-v$(VERSION)
|
||||||
|
docker push hunterlong/statup:base
|
||||||
|
docker push hunterlong/statup:base-v$(VERSION)
|
||||||
|
|
||||||
|
docker-build-base: clean
|
||||||
wget -q https://assets.statup.io/sass && chmod +x sass
|
wget -q https://assets.statup.io/sass && chmod +x sass
|
||||||
$(XGO) --targets=linux/amd64 -ldflags="-X main.VERSION=$(VERSION) -linkmode external -extldflags -static" -out alpine ./cmd
|
$(XGO) --targets=linux/amd64 -ldflags="-X main.VERSION=$(VERSION) -linkmode external -extldflags -static" -out alpine ./cmd
|
||||||
docker build -t hunterlong/statup:base -f dev/Dockerfile-base .
|
docker build -t hunterlong/statup:base -f dev/Dockerfile-base .
|
||||||
|
|
||||||
docker-build-base: docker-base
|
|
||||||
docker build -t hunterlong/statup:base --no-cache -f dev/Dockerfile-base .
|
|
||||||
docker tag hunterlong/statup:base hunterlong/statup:base-v$(VERSION)
|
docker tag hunterlong/statup:base hunterlong/statup:base-v$(VERSION)
|
||||||
|
|
||||||
docker-build-latest:
|
docker-build-latest:
|
||||||
|
|
|
@ -499,7 +499,7 @@ func RunPrometheusHandler(t *testing.T) {
|
||||||
rr := httptest.NewRecorder()
|
rr := httptest.NewRecorder()
|
||||||
route.ServeHTTP(rr, req)
|
route.ServeHTTP(rr, req)
|
||||||
t.Log(rr.Body.String())
|
t.Log(rr.Body.String())
|
||||||
assert.True(t, strings.Contains(rr.Body.String(), "statup_total_services 7"))
|
assert.True(t, strings.Contains(rr.Body.String(), "statup_total_services 6"))
|
||||||
assert.True(t, handlers.IsAuthenticated(req))
|
assert.True(t, handlers.IsAuthenticated(req))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,9 +249,8 @@ func TestDeleteService(t *testing.T) {
|
||||||
err = service.Delete()
|
err = service.Delete()
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
count, err = CoreApp.SelectAllServices()
|
services := CoreApp.Services()
|
||||||
assert.Nil(t, err)
|
assert.Equal(t, 7, len(services))
|
||||||
assert.Equal(t, 7, len(count))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServiceCloseRoutine(t *testing.T) {
|
func TestServiceCloseRoutine(t *testing.T) {
|
||||||
|
|
|
@ -500,7 +500,7 @@ func TestPrometheusHandler(t *testing.T) {
|
||||||
Router().ServeHTTP(rr, req)
|
Router().ServeHTTP(rr, req)
|
||||||
body := rr.Body.String()
|
body := rr.Body.String()
|
||||||
assert.Equal(t, 200, rr.Code)
|
assert.Equal(t, 200, rr.Code)
|
||||||
assert.Contains(t, body, "statup_total_services 7")
|
assert.Contains(t, body, "statup_total_services 6")
|
||||||
assert.True(t, IsRouteAuthenticated(req))
|
assert.True(t, IsRouteAuthenticated(req))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,10 +83,9 @@ func CreateServiceHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Log(3, fmt.Sprintf("Error starting %v check routine. %v", service.Name, err))
|
utils.Log(3, fmt.Sprintf("Error starting %v check routine. %v", service.Name, err))
|
||||||
}
|
}
|
||||||
|
service = service.Check(true)
|
||||||
go service.CheckQueue(true)
|
go service.CheckQueue(true)
|
||||||
core.OnNewService(service)
|
core.OnNewService(service)
|
||||||
|
|
||||||
ExecuteResponse(w, r, "services.html", core.CoreApp.Services())
|
ExecuteResponse(w, r, "services.html", core.CoreApp.Services())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ func (c *Core) AddService(s *Service) {
|
||||||
|
|
||||||
func (c *Core) RemoveService(s int) []*Service {
|
func (c *Core) RemoveService(s int) []*Service {
|
||||||
slice := c.dbServices
|
slice := c.dbServices
|
||||||
return append(slice[:s], slice[s+1:]...)
|
c.dbServices = append(slice[:s], slice[s+1:]...)
|
||||||
|
return c.dbServices
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Core) GetServices() []*Service {
|
func (c *Core) GetServices() []*Service {
|
||||||
|
|
Loading…
Reference in New Issue