Skip to content

Commit f7a1fca

Browse files
committed
tmp 2
1 parent 167f006 commit f7a1fca

File tree

6 files changed

+44
-47
lines changed

6 files changed

+44
-47
lines changed

qbft/spectest/tests/controller_spectest.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ func (test *ControllerSpecTest) Run(t *testing.T) {
7474
}
7575
}
7676

77-
if len(test.ExpectedErrorCode) != 0 {
78-
require.EqualError(t, lastErr, test.ExpectedErrorCode)
79-
} else {
80-
require.NoError(t, lastErr)
81-
}
77+
tests.AssertErrorCode(t, test.ExpectedErrorCode, lastErr)
8278
}
8379

8480
func (test *ControllerSpecTest) generateController() *qbft.Controller {

ssv/spectest/tests/committee/test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,32 +135,32 @@ type MultiCommitteeSpecTest struct {
135135
PrivateKeys *testingutils.PrivateKeyInfo `json:"PrivateKeys,omitempty"`
136136
}
137137

138-
func (test *MultiCommitteeSpecTest) TestName() string {
139-
return test.Name
138+
func (mTest *MultiCommitteeSpecTest) TestName() string {
139+
return mTest.Name
140140
}
141141

142-
func (test *MultiCommitteeSpecTest) Run(t *testing.T) {
143-
test.overrideStateComparison(t)
142+
func (mTest *MultiCommitteeSpecTest) Run(t *testing.T) {
143+
mTest.overrideStateComparison(t)
144144

145-
for _, test := range test.Tests {
145+
for _, test := range mTest.Tests {
146146
t.Run(test.TestName(), func(t *testing.T) {
147147
test.RunAsPartOfMultiTest(t)
148148
})
149149
}
150150
}
151151

152152
// overrideStateComparison overrides the post state comparison for all tests in the multi test
153-
func (test *MultiCommitteeSpecTest) overrideStateComparison(t *testing.T) {
154-
testsName := strings.ReplaceAll(test.TestName(), " ", "_")
155-
for _, test := range test.Tests {
153+
func (mTest *MultiCommitteeSpecTest) overrideStateComparison(t *testing.T) {
154+
testsName := strings.ReplaceAll(mTest.TestName(), " ", "_")
155+
for _, test := range mTest.Tests {
156156
path := filepath.Join(testsName, test.TestName())
157-
overrideStateComparison(t, test, path, reflect.TypeOf(test).String())
157+
overrideStateComparison(t, test, path, reflect.TypeOf(mTest).String())
158158
}
159159
}
160160

161-
func (test *MultiCommitteeSpecTest) GetPostState() (interface{}, error) {
162-
ret := make(map[string]types.Root, len(test.Tests))
163-
for _, test := range test.Tests {
161+
func (mTest *MultiCommitteeSpecTest) GetPostState() (interface{}, error) {
162+
ret := make(map[string]types.Root, len(mTest.Tests))
163+
for _, test := range mTest.Tests {
164164
err := test.runPreTesting()
165165
if err != nil && !tests.MatchesErrorCode(test.ExpectedErrorCode, err) {
166166
return nil, fmt.Errorf(

ssv/spectest/tests/multi_msg_processing_spectest.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,32 @@ type MultiMsgProcessingSpecTest struct {
2020
PrivateKeys *testingutils.PrivateKeyInfo `json:"PrivateKeys,omitempty"`
2121
}
2222

23-
func (test *MultiMsgProcessingSpecTest) TestName() string {
24-
return test.Name
23+
func (mTest *MultiMsgProcessingSpecTest) TestName() string {
24+
return mTest.Name
2525
}
2626

27-
func (test *MultiMsgProcessingSpecTest) Run(t *testing.T) {
28-
test.overrideStateComparison(t)
27+
func (mTest *MultiMsgProcessingSpecTest) Run(t *testing.T) {
28+
mTest.overrideStateComparison(t)
2929

30-
for _, test := range test.Tests {
30+
for _, test := range mTest.Tests {
3131
t.Run(test.TestName(), func(t *testing.T) {
3232
test.RunAsPartOfMultiTest(t)
3333
})
3434
}
3535
}
3636

3737
// overrideStateComparison overrides the post state comparison for all tests in the multi test
38-
func (test *MultiMsgProcessingSpecTest) overrideStateComparison(t *testing.T) {
39-
testsName := strings.ReplaceAll(test.TestName(), " ", "_")
40-
for _, test := range test.Tests {
38+
func (mTest *MultiMsgProcessingSpecTest) overrideStateComparison(t *testing.T) {
39+
testsName := strings.ReplaceAll(mTest.TestName(), " ", "_")
40+
for _, test := range mTest.Tests {
4141
path := filepath.Join(testsName, test.TestName())
42-
overrideStateComparison(t, test, path, reflect.TypeOf(test).String())
42+
overrideStateComparison(t, test, path, reflect.TypeOf(mTest).String())
4343
}
4444
}
4545

46-
func (test *MultiMsgProcessingSpecTest) GetPostState() (interface{}, error) {
47-
ret := make(map[string]types.Root, len(test.Tests))
48-
for _, test := range test.Tests {
46+
func (mTest *MultiMsgProcessingSpecTest) GetPostState() (interface{}, error) {
47+
ret := make(map[string]types.Root, len(mTest.Tests))
48+
for _, test := range mTest.Tests {
4949
_, _, err := test.runPreTesting()
5050
if err != nil && !MatchesErrorCode(test.ExpectedErrorCode, err) {
5151
return nil, fmt.Errorf(

ssv/spectest/tests/runner/duties/newduty/test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,23 @@ type MultiStartNewRunnerDutySpecTest struct {
131131
PrivateKeys *testingutils.PrivateKeyInfo `json:"PrivateKeys,omitempty"`
132132
}
133133

134-
func (test *MultiStartNewRunnerDutySpecTest) TestName() string {
135-
return test.Name
134+
func (mTest *MultiStartNewRunnerDutySpecTest) TestName() string {
135+
return mTest.Name
136136
}
137137

138-
func (test *MultiStartNewRunnerDutySpecTest) Run(t *testing.T) {
139-
test.overrideStateComparison(t)
138+
func (mTest *MultiStartNewRunnerDutySpecTest) Run(t *testing.T) {
139+
mTest.overrideStateComparison(t)
140140

141-
for _, test := range test.Tests {
141+
for _, test := range mTest.Tests {
142142
t.Run(test.TestName(), func(t *testing.T) {
143143
test.RunAsPartOfMultiTest(t)
144144
})
145145
}
146146
}
147147

148-
func (test *MultiStartNewRunnerDutySpecTest) GetPostState() (interface{}, error) {
149-
ret := make(map[string]types.Root, len(test.Tests))
150-
for _, test := range test.Tests {
148+
func (mTest *MultiStartNewRunnerDutySpecTest) GetPostState() (interface{}, error) {
149+
ret := make(map[string]types.Root, len(mTest.Tests))
150+
for _, test := range mTest.Tests {
151151
err := test.runPreTesting()
152152
if err != nil && !tests.MatchesErrorCode(test.ExpectedErrorCode, err) {
153153
return nil, fmt.Errorf(
@@ -163,11 +163,11 @@ func (test *MultiStartNewRunnerDutySpecTest) GetPostState() (interface{}, error)
163163
}
164164

165165
// overrideStateComparison overrides the post state comparison for all tests in the multi test
166-
func (test *MultiStartNewRunnerDutySpecTest) overrideStateComparison(t *testing.T) {
167-
testsName := strings.ReplaceAll(test.TestName(), " ", "_")
168-
for _, test := range test.Tests {
166+
func (mTest *MultiStartNewRunnerDutySpecTest) overrideStateComparison(t *testing.T) {
167+
testsName := strings.ReplaceAll(mTest.TestName(), " ", "_")
168+
for _, test := range mTest.Tests {
169169
path := filepath.Join(testsName, test.TestName())
170-
overrideStateComparison(t, test, path, reflect.TypeOf(test).String())
170+
overrideStateComparison(t, test, path, reflect.TypeOf(mTest).String())
171171
}
172172
}
173173

ssv/spectest/tests/valcheck/test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,19 @@ type MultiSpecTest struct {
8686
PrivateKeys *testingutils.PrivateKeyInfo `json:"PrivateKeys,omitempty"`
8787
}
8888

89-
func (test *MultiSpecTest) TestName() string {
90-
return test.Name
89+
func (mTest *MultiSpecTest) TestName() string {
90+
return mTest.Name
9191
}
9292

93-
func (test *MultiSpecTest) Run(t *testing.T) {
94-
for _, test := range test.Tests {
93+
func (mTest *MultiSpecTest) Run(t *testing.T) {
94+
for _, test := range mTest.Tests {
9595
t.Run(test.TestName(), func(t *testing.T) {
9696
test.Run(t)
9797
})
9898
}
9999
}
100100

101-
func (test *MultiSpecTest) GetPostState() (interface{}, error) {
101+
func (mTest *MultiSpecTest) GetPostState() (interface{}, error) {
102102
return nil, nil
103103
}
104104

types/testingutils/comparable/helpers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import (
1111
spec2 "github.com/attestantio/go-eth2-client/spec"
1212
ssz "github.com/ferranbt/fastssz"
1313
"github.com/google/go-cmp/cmp"
14-
"github.com/ssvlabs/ssv-spec/types"
1514
"github.com/stretchr/testify/require"
15+
16+
"github.com/ssvlabs/ssv-spec/types"
1617
)
1718

1819
func NoErrorEncoding(obj ssz.Marshaler) []byte {

0 commit comments

Comments
 (0)