test(web): on ci
continuous-integration/drone the build was successful Details

This commit is contained in:
Geno 2021-06-23 21:23:46 +02:00
parent 72fa8a8113
commit 0e411ba5e2
2 changed files with 9 additions and 2 deletions

View File

@ -21,7 +21,7 @@ pipeline:
group: test group: test
commands: commands:
- go get -d -t ./... - go get -d -t ./...
- go test -ldflags "-X dev.sum7.eu/genofire/golang-lib/web/webtest.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable -X dev.sum7.eu/genofire/golang-lib/database.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable" $(go list ./... | grep -v /vendor/) -v -failfast -p 1 -coverprofile .testCoverage.txt - go test -ldflags "-X dev.sum7.eu/genofire/golang-lib/web.TestRunTLS=false -X dev.sum7.eu/genofire/golang-lib/web/webtest.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable -X dev.sum7.eu/genofire/golang-lib/database.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable" $(go list ./... | grep -v /vendor/) -v -failfast -p 1 -coverprofile .testCoverage.txt
- go tool cover -func=".testCoverage.txt" - go tool cover -func=".testCoverage.txt"
test-race: test-race:
@ -29,4 +29,4 @@ pipeline:
group: test-race group: test-race
commands: commands:
- go get -d -t ./... - go get -d -t ./...
- go test -ldflags "-X dev.sum7.eu/genofire/golang-lib/web/webtest.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable -X dev.sum7.eu/genofire/golang-lib/database.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable" $(go list ./... | grep -v /vendor/) -race - go test -ldflags "-X dev.sum7.eu/genofire/golang-lib/web.TestRunTLS=false -X dev.sum7.eu/genofire/golang-lib/web/webtest.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable -X dev.sum7.eu/genofire/golang-lib/database.DBConnection=postgres://root:root@database:26257/defaultdb?sslmode=disable" $(go list ./... | grep -v /vendor/) -race

View File

@ -7,6 +7,10 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
var (
TestRunTLS = ""
)
func TestRun(t *testing.T) { func TestRun(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
@ -24,6 +28,9 @@ func TestRun(t *testing.T) {
s.Run() s.Run()
}) })
if TestRunTLS == "false" {
return
}
s.Listen = "" s.Listen = ""
// httpS - failed // httpS - failed
err = s.Run() err = s.Run()