Skip to content

Commit ed6a218

Browse files
committed
Add race detection flag support
- Use integration.Generate with WithRaceDetection flag - Fix regression: use integration.New() to allow platform factory registration before Generate() Signed-off-by: AkramBitar <akram@il.ibm.com>
1 parent 7b45d74 commit ed6a218

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

integration/token/fungible/dlogx/dlog_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ func newTestSuite(commType fsc.P2PCommunicationType, mask int, factor int, token
8989
FSCLogSpec: "grpc=error:info",
9090
TokenSelector: tokenSelector,
9191
})...)
92+
if err != nil {
93+
return nil, err
94+
}
95+
// i.EnableRaceDetector()
9296
i.RegisterPlatformFactory(fabricx.NewPlatformFactory())
9397
i.RegisterPlatformFactory(token.NewPlatformFactory(i))
9498
i.Generate()
95-
96-
return i, err
99+
return i, nil
97100
})
98101

99102
return ts, selector

integration/token/test_utils.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ func replicaName(name string, idx int) string {
115115
func NewTestSuite(startPort func() int, topologies []api.Topology) *TestSuite {
116116
return &TestSuite{
117117
generator: func() (*integration.Infrastructure, error) {
118-
return integration.New(startPort(), "", topologies...)
118+
i, err := integration.New(startPort(), "", topologies...)
119+
if err != nil {
120+
return nil, err
121+
}
122+
i.EnableRaceDetector()
123+
return i, nil
119124
},
120125
}
121126
}
@@ -126,9 +131,12 @@ func NewLocalTestSuite(startPort func() int, topologies []api.Topology) *TestSui
126131
return &TestSuite{
127132
generator: func() (*integration.Infrastructure, error) {
128133
i, err := integration.New(startPort(), "./testdata", topologies...)
134+
if err != nil {
135+
return nil, err
136+
}
137+
i.EnableRaceDetector()
129138
i.DeleteOnStop = false
130-
131-
return i, err
139+
return i, nil
132140
},
133141
}
134142
}

0 commit comments

Comments
 (0)