-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_test.go
56 lines (45 loc) · 1.13 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package pfcregtest
import (
"flag"
"github.com/jfixby/coinharness"
"github.com/jfixby/pin"
"os"
"testing"
)
// ObtainHarness manages access to the Pool for test cases
func ObtainHarness(tag string) *coinharness.Harness {
s := testSetup.harnessPool.ObtainSpawnableConcurrentSafe(tag)
return s.(*coinharness.Harness)
}
func ObtainWalletHarness(tag string) *coinharness.Harness {
s := testSetup.harnessWalletPool.ObtainSpawnableConcurrentSafe(tag)
return s.(*coinharness.Harness)
}
var testSetup *SimpleTestSetup
// TestMain is executed by go-test, and is
// responsible for setting up and disposing test environment.
func TestMain(m *testing.M) {
flag.Parse()
testSetup = Setup()
if !testing.Short() {
// Initialize harnesses before running any tests
// otherwise they will be created on request.
{
tagsList := []string{
//mainHarnessName,
}
testSetup.harnessPool.InitTags(tagsList)
}
{
tagsList := []string{
//mainWalletHarnessName,
}
testSetup.harnessWalletPool.InitTags(tagsList)
}
}
// Run tests
exitCode := m.Run()
testSetup.TearDown()
pin.VerifyNoAssetsLeaked()
os.Exit(exitCode)
}