Changed test names in order to filter mainnet/testnet targets

pull/76/head
Jakub Matys 2018-10-16 12:24:38 +02:00
parent 9f425564ed
commit acae88fcdc
2 changed files with 15 additions and 5 deletions

View File

@ -2,20 +2,20 @@ stages:
- build
- test
build:binary:
build:
stage: build
tags:
- blockbook
script: make build
test:unittest:
unit-test:
stage: test
tags:
- blockbook
script: make test
test:integration:
integration-test:
stage: test
tags:
- blockbook
script: make test-integration ARGS="-run='TestIntegration/(bcash|bgold|bitcoin|dash|dogecoin|litecoin|vertcoin|zcash)/'"
script: make test-integration ARGS="-run='TestIntegration/(bcash|bgold|bitcoin|dash|dogecoin|litecoin|vertcoin|zcash)=main/'"

View File

@ -17,6 +17,7 @@ import (
"path/filepath"
"reflect"
"sort"
"strings"
"testing"
"github.com/jakm/btcutil/chaincfg"
@ -45,7 +46,8 @@ func runIntegrationTests(t *testing.T) {
for _, coin := range keys {
cfg := tests[coin]
t.Run(coin, func(t *testing.T) { runTests(t, coin, cfg) })
name := getMatchableName(coin)
t.Run(name, func(t *testing.T) { runTests(t, coin, cfg) })
}
}
@ -60,6 +62,14 @@ func loadTests(path string) (map[string]map[string]json.RawMessage, error) {
return v, err
}
func getMatchableName(coin string) string {
if idx := strings.Index(coin, "_testnet"); idx != -1 {
return coin[:idx] + "=test"
} else {
return coin + "=main"
}
}
func runTests(t *testing.T, coin string, cfg map[string]json.RawMessage) {
if cfg == nil || len(cfg) == 0 {
t.Skip("No tests to run")