CI: Better mutual exclusivity of unit and integration tests

This commit is contained in:
diamondburned (Forefront) 2020-05-30 15:19:51 -07:00
parent 783dfe7ba6
commit 77d6067340
1 changed files with 10 additions and 6 deletions

View File

@ -24,10 +24,12 @@
"unit_test": {
"stage": "test",
"timeout": "2m", # 2 minutes
# Don't run the test if we have a $BOT_TOKEN, because
# integration_test will run instead.
"exclude": {
"variables": [ "$BOT_TOKEN" ]
},
"script": [
# Don't run the test if we have a $BOT_TOKEN, because
# integration_test will run instead.
"[ $BOT_TOKEN ] && exit",
"go test -v -coverprofile $COV ./...",
"go tool cover -func $COV"
]
@ -35,10 +37,12 @@
"integration_test": {
"stage": "test",
"timeout": "2m", # 2 minutes
# Run the test only if we have $BOT_TOKEN, else fallback to unit
# tests.
"only": {
"variables": [ "$BOT_TOKEN" ]
},
"script": [
# Run the test only if we have $BOT_TOKEN, else fallback to unit
# tests.
"[ ! $BOT_TOKEN ] && exit",
"go get ./...",
# Test this package along with dismock.
"go test -coverpkg $tested -coverprofile $COV -tags integration -v ./... $dismock",