CI: Added Dismock, better coverage parsing

This commit is contained in:
diamondburned (Forefront) 2020-05-30 14:32:23 -07:00
parent 93fbfd98d0
commit bafeb1082a
3 changed files with 27 additions and 7 deletions

View File

@ -21,8 +21,6 @@ unit_test:
script:
- go test -v -coverprofile $COV ./...
- go tool cover -func $COV
| grep -F 'total:'
| sed -E 's|total:\s+\(.*?\)\s+([0-9]+\.[0-9]+%)|TEST_COVERAGE=\1|'
integration_test:
stage: test
@ -31,9 +29,17 @@ integration_test:
- '[ ! "$BOT_TOKEN" ] && exit'
# go get first, so it doesn't count towards the timeout.
- go get ./...
# Timeout test after 120 seconds (2 minutes)
- timeout 120 go test -tags integration -v -coverprofile $COV ./...
- go tool cover -func $COV
| grep -F 'total:'
| sed -E 's|total:\s+\(.*?\)\s+([0-9]+\.[0-9]+%)|TEST_COVERAGE=\1|'
# Timeout test after 120 seconds (2 minutes)
- timeout 120 go test
# Known packages that are important to do integration tests on.
-coverpkg "./api,./gateway,./bot,./discord"
-coverprofile $COV
-tags integration
-v
# Test both the current package and the external API mocking package.
./...
github.com/mavolin/dismock/pkg/dismock
- go tool cover -func $COV

1
go.mod
View File

@ -5,6 +5,7 @@ go 1.13
require (
github.com/gorilla/schema v1.1.0
github.com/gorilla/websocket v1.4.2
github.com/mavolin/dismock v1.0.0 // indirect
github.com/pkg/errors v0.9.1
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1

13
go.sum
View File

@ -1,9 +1,19 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/diamondburned/arikawa v0.9.2/go.mod h1:nIhVIatzTQhPUa7NB8w4koG1RF9gYbpAr8Fj8sKq660=
github.com/gorilla/schema v1.1.0 h1:CamqUDOFUBqzrvxuz2vEwo8+SUdwsluFh7IlzJh30LY=
github.com/gorilla/schema v1.1.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/mavolin/dismock v1.0.0 h1:guE3fHMeTWtHTqBw1U3bTJdPgJeExb6D9lZoDFTVHs0=
github.com/mavolin/dismock v1.0.0/go.mod h1:2wvD28lUL21buoqJ/IOsW4B3emwNJXsVfG4fal9KnzY=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5 h1:Q7tZBpemrlsc2I7IyODzhtallWRSm4Q0d09pL6XbQtU=
@ -16,3 +26,6 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=