From acae88fcdccdef9f6ad591a81ca56b272248fbe4 Mon Sep 17 00:00:00 2001 From: Jakub Matys Date: Tue, 16 Oct 2018 12:24:38 +0200 Subject: [PATCH] Changed test names in order to filter mainnet/testnet targets --- .gitlab-ci.yml | 8 ++++---- tests/integration.go | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9446c843..fe2b77c3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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/'" diff --git a/tests/integration.go b/tests/integration.go index e0483472..56a73ddb 100644 --- a/tests/integration.go +++ b/tests/integration.go @@ -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")