Skip to content

Commit 17370c5

Browse files
committed
Removed flakey testcases and optimized for parallel test runs
1 parent 49d8ece commit 17370c5

File tree

5 files changed

+114
-94
lines changed

5 files changed

+114
-94
lines changed

pkg/loop/internal/goplugin/service.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package goplugin
33
import (
44
"context"
55
"errors"
6+
"fmt"
67
"time"
78

89
"google.golang.org/grpc"
@@ -82,6 +83,7 @@ type ServiceServer struct {
8283
}
8384

8485
func (s *ServiceServer) Close(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
86+
fmt.Println("CLOSING CLIENT SERVICE")
8587
return &emptypb.Empty{}, s.Srv.Close()
8688
}
8789

pkg/loop/internal/relayer/pluginprovider/contractreader/contract_reader.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ func (c *Client) Bind(ctx context.Context, bindings []types.BoundContract) error
328328
}
329329

330330
_, err := c.grpc.Bind(ctx, &pb.BindRequest{Bindings: pbBindings})
331+
fmt.Println("ERROR:", err)
331332
return net.WrapRPCErr(err)
332333
}
333334

pkg/loop/internal/relayer/pluginprovider/contractreader/contract_reader_test.go

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ func (it *fakeContractReaderInterfaceTester) Setup(_ *testing.T) {
312312
}
313313
}
314314

315+
func (it *fakeContractReaderInterfaceTester) Init(_ *testing.T) {
316+
317+
}
318+
315319
func (it *fakeContractReaderInterfaceTester) GetContractReader(_ *testing.T) types.ContractReader {
316320
return it.impl
317321
}
@@ -1162,6 +1166,7 @@ func runContractReaderByIDQueryKey(t *testing.T) {
11621166
func(t *testing.T) {
11631167
t.Parallel()
11641168
fake := &fakeContractReader{}
1169+
fakeCW := &fakeContractWriter{}
11651170
tester := &fakeContractReaderInterfaceTester{impl: fake}
11661171
tester.Setup(t)
11671172

@@ -1179,14 +1184,14 @@ func runContractReaderByIDQueryKey(t *testing.T) {
11791184
require.NoError(t, cr.Bind(ctx, toBind))
11801185

11811186
ts1AnyContract := CreateTestStruct(0, tester)
1182-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts1AnyContract, anyContract, types.Unconfirmed)
1187+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts1AnyContract, anyContract, types.Unconfirmed)
11831188
ts2AnyContract := CreateTestStruct(1, tester)
1184-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts2AnyContract, anyContract, types.Unconfirmed)
1189+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts2AnyContract, anyContract, types.Unconfirmed)
11851190

11861191
ts1AnySecondContract := CreateTestStruct(0, tester)
1187-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts1AnySecondContract, anySecondContract, types.Unconfirmed)
1192+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts1AnySecondContract, anySecondContract, types.Unconfirmed)
11881193
ts2AnySecondContract := CreateTestStruct(1, tester)
1189-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts2AnySecondContract, anySecondContract, types.Unconfirmed)
1194+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts2AnySecondContract, anySecondContract, types.Unconfirmed)
11901195

11911196
tsAnyContractType := &TestStruct{}
11921197
require.Eventually(t, func() bool {
@@ -1205,6 +1210,8 @@ func runContractReaderByIDQueryKey(t *testing.T) {
12051210
func(t *testing.T) {
12061211
t.Parallel()
12071212
fake := &fakeContractReader{}
1213+
fakeCW := &fakeContractWriter{}
1214+
12081215
tester := &fakeContractReaderInterfaceTester{impl: fake}
12091216
tester.Setup(t)
12101217

@@ -1225,22 +1232,22 @@ func runContractReaderByIDQueryKey(t *testing.T) {
12251232
require.NoError(t, cr.Bind(ctx, toBind))
12261233

12271234
ts1AnyContract1 := CreateTestStruct(0, tester)
1228-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts1AnyContract1, anyContract1, types.Unconfirmed)
1235+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts1AnyContract1, anyContract1, types.Unconfirmed)
12291236
ts2AnyContract1 := CreateTestStruct(1, tester)
1230-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts2AnyContract1, anyContract1, types.Unconfirmed)
1237+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts2AnyContract1, anyContract1, types.Unconfirmed)
12311238
ts1AnyContract2 := CreateTestStruct(2, tester)
1232-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts1AnyContract2, anyContract2, types.Unconfirmed)
1239+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts1AnyContract2, anyContract2, types.Unconfirmed)
12331240
ts2AnyContract2 := CreateTestStruct(3, tester)
1234-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts2AnyContract2, anyContract2, types.Unconfirmed)
1241+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts2AnyContract2, anyContract2, types.Unconfirmed)
12351242

12361243
ts1AnySecondContract1 := CreateTestStruct(4, tester)
1237-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts1AnySecondContract1, anySecondContract1, types.Unconfirmed)
1244+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts1AnySecondContract1, anySecondContract1, types.Unconfirmed)
12381245
ts2AnySecondContract1 := CreateTestStruct(5, tester)
1239-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts2AnySecondContract1, anySecondContract1, types.Unconfirmed)
1246+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts2AnySecondContract1, anySecondContract1, types.Unconfirmed)
12401247
ts1AnySecondContract2 := CreateTestStruct(6, tester)
1241-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts1AnySecondContract2, anySecondContract2, types.Unconfirmed)
1248+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts1AnySecondContract2, anySecondContract2, types.Unconfirmed)
12421249
ts2AnySecondContract2 := CreateTestStruct(7, tester)
1243-
_ = SubmitTransactionToCW(t, tester, MethodTriggeringEvent, ts2AnySecondContract2, anySecondContract2, types.Unconfirmed)
1250+
_ = SubmitTransactionToCW(t, tester, fakeCW, MethodTriggeringEvent, ts2AnySecondContract2, anySecondContract2, types.Unconfirmed)
12441251

12451252
tsAnyContractType := &TestStruct{}
12461253
require.Eventually(t, func() bool {

0 commit comments

Comments
 (0)