From 0e411ba5e2527913a2475ec7286c63968079860f Mon Sep 17 00:00:00 2001 From: Geno Date: Wed, 23 Jun 2021 21:23:46 +0200 Subject: [PATCH] test(web): on ci --- .woodpecker.yml | 4 ++-- web/main_test.go | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index ff5597a..0b7ae44 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -21,7 +21,7 @@ pipeline: group: test commands: - 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" test-race: @@ -29,4 +29,4 @@ pipeline: group: test-race commands: - 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 diff --git a/web/main_test.go b/web/main_test.go index 7b207af..75ec0ab 100644 --- a/web/main_test.go +++ b/web/main_test.go @@ -7,6 +7,10 @@ import ( "github.com/stretchr/testify/assert" ) +var ( + TestRunTLS = "" +) + func TestRun(t *testing.T) { assert := assert.New(t) @@ -24,6 +28,9 @@ func TestRun(t *testing.T) { s.Run() }) + if TestRunTLS == "false" { + return + } s.Listen = "" // httpS - failed err = s.Run()