mirror of
https://github.com/pushbits/server.git
synced 2025-05-24 22:36:33 +02:00
Fix tests after Go update
This commit is contained in:
parent
0b8d22d293
commit
ed78c18c24
3 changed files with 7 additions and 6 deletions
8
Makefile
8
Makefile
|
@ -5,6 +5,8 @@ DOCS_DIR := ./docs
|
||||||
OUT_DIR := ./out
|
OUT_DIR := ./out
|
||||||
TESTS_DIR := ./tests
|
TESTS_DIR := ./tests
|
||||||
|
|
||||||
|
GO_FILES := $(shell find . -type f \( -iname '*.go' ! -path "./tests/semgrep-rules/*" \))
|
||||||
|
|
||||||
PB_BUILD_VERSION ?= $(shell git describe --tags)
|
PB_BUILD_VERSION ?= $(shell git describe --tags)
|
||||||
ifeq ($(PB_BUILD_VERSION),)
|
ifeq ($(PB_BUILD_VERSION),)
|
||||||
_ := $(error Cannot determine build version)
|
_ := $(error Cannot determine build version)
|
||||||
|
@ -26,9 +28,9 @@ clean:
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
touch $(SEMGREP_MODFILE) # See [1].
|
touch $(SEMGREP_MODFILE) # See [1].
|
||||||
stdout=$$(gofumpt -l . 2>&1); if [ "$$stdout" ]; then exit 1; fi
|
stdout=$$(gofumpt -l $(GO_FILES) 2>&1); if [ "$$stdout" ]; then exit 1; fi
|
||||||
go vet ./...
|
go vet ./...
|
||||||
gocyclo -over 10 $(shell find . -type f \( -iname '*.go' ! -path "./tests/semgrep-rules/*" \))
|
gocyclo -over 10 $(GO_FILES)
|
||||||
staticcheck ./...
|
staticcheck ./...
|
||||||
go test -v -cover ./...
|
go test -v -cover ./...
|
||||||
gosec -exclude-dir=tests ./...
|
gosec -exclude-dir=tests ./...
|
||||||
|
@ -48,7 +50,7 @@ setup:
|
||||||
|
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
fmt:
|
fmt:
|
||||||
gofumpt -l -w .
|
gofumpt -l -w $(GO_FILES)
|
||||||
|
|
||||||
.PHONY: swag
|
.PHONY: swag
|
||||||
swag:
|
swag:
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
var version string
|
var version string
|
||||||
|
|
||||||
func setupCleanup(db *database.Database, dp *dispatcher.Dispatcher) {
|
func setupCleanup(db *database.Database, dp *dispatcher.Dispatcher) {
|
||||||
c := make(chan os.Signal)
|
c := make(chan os.Signal, 2)
|
||||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
@ -19,8 +19,7 @@ func TestApi_SuccessOrAbort(t *testing.T) {
|
||||||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 500", Endpoint: "/", ShouldStatus: 500}
|
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 500", Endpoint: "/", ShouldStatus: 500}
|
||||||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 200", Endpoint: "/", ShouldStatus: 200}
|
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 200", Endpoint: "/", ShouldStatus: 200}
|
||||||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 404", Endpoint: "/", ShouldStatus: 404}
|
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 404", Endpoint: "/", ShouldStatus: 404}
|
||||||
testCases[errors.New("this is an error")] = tests.Request{Name: "Error - 1001", Endpoint: "/", ShouldStatus: 1001}
|
testCases[nil] = tests.Request{Name: "No Error - 200", Endpoint: "/", ShouldStatus: 200}
|
||||||
testCases[nil] = tests.Request{Name: "No Error - 1001", Endpoint: "/", ShouldStatus: 1001}
|
|
||||||
testCases[nil] = tests.Request{Name: "No Error - 404", Endpoint: "/", ShouldStatus: 404}
|
testCases[nil] = tests.Request{Name: "No Error - 404", Endpoint: "/", ShouldStatus: 404}
|
||||||
|
|
||||||
for forcedErr, testCase := range testCases {
|
for forcedErr, testCase := range testCases {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue