Skip to content

Commit 6223621

Browse files
committed
[FAB-10686] testutil->testify protos/ledger
Change-Id: I3577dc937d58540c885c96e6f9d6b7883389f4db Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent f80782b commit 6223621

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

protos/ledger/rwset/kvrwset/tests/kv_rwset_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222

2323
"github.com/davecgh/go-spew/spew"
2424
"github.com/golang/protobuf/proto"
25-
"github.com/hyperledger/fabric/common/ledger/testutil"
2625
"github.com/hyperledger/fabric/protos/ledger/rwset/kvrwset"
26+
"github.com/stretchr/testify/assert"
2727
)
2828

2929
const (
@@ -35,12 +35,12 @@ const (
3535
// v1.0. This is to make sure that any incompatible changes does not go uncaught.
3636
func TestKVRWSetV1BackwardCompatible(t *testing.T) {
3737
protoBytes, err := ioutil.ReadFile(binaryTestFileName)
38-
testutil.AssertNoError(t, err, "")
38+
assert.NoError(t, err)
3939
kvrwset1 := &kvrwset.KVRWSet{}
40-
testutil.AssertNoError(t, proto.Unmarshal(protoBytes, kvrwset1), "")
40+
assert.NoError(t, proto.Unmarshal(protoBytes, kvrwset1))
4141
kvrwset2 := constructSampleKVRWSet()
4242
t.Logf("kvrwset1=%s, kvrwset2=%s", spew.Sdump(kvrwset1), spew.Sdump(kvrwset2))
43-
testutil.AssertEquals(t, kvrwset1, kvrwset2)
43+
assert.Equal(t, kvrwset2, kvrwset1)
4444
}
4545

4646
// testPrepareBinaryFileSampleKVRWSetV1 constructs a proto message for kvrwset and marshals its bytes to file 'kvrwsetV1ProtoBytes'.
@@ -49,8 +49,8 @@ func TestKVRWSetV1BackwardCompatible(t *testing.T) {
4949
// using golang test framwork
5050
func testPrepareBinaryFileSampleKVRWSetV1(t *testing.T) {
5151
b, err := proto.Marshal(constructSampleKVRWSet())
52-
testutil.AssertNoError(t, err, "")
53-
testutil.AssertNoError(t, ioutil.WriteFile(binaryTestFileName, b, 0775), "")
52+
assert.NoError(t, err)
53+
assert.NoError(t, ioutil.WriteFile(binaryTestFileName, b, 0775))
5454
}
5555

5656
func constructSampleKVRWSet() *kvrwset.KVRWSet {

protos/ledger/rwset/tests/rwset_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222

2323
"github.com/davecgh/go-spew/spew"
2424
"github.com/golang/protobuf/proto"
25-
"github.com/hyperledger/fabric/common/ledger/testutil"
2625
"github.com/hyperledger/fabric/protos/ledger/rwset"
26+
"github.com/stretchr/testify/assert"
2727
)
2828

2929
const (
@@ -35,12 +35,12 @@ const (
3535
// v1.0. This is to make sure that any incompatible changes does not go uncaught.
3636
func TestRWSetV1BackwardCompatible(t *testing.T) {
3737
protoBytes, err := ioutil.ReadFile(binaryTestFileName)
38-
testutil.AssertNoError(t, err, "")
38+
assert.NoError(t, err)
3939
rwset1 := &rwset.TxReadWriteSet{}
40-
testutil.AssertNoError(t, proto.Unmarshal(protoBytes, rwset1), "")
40+
assert.NoError(t, proto.Unmarshal(protoBytes, rwset1))
4141
rwset2 := constructSampleRWSet()
4242
t.Logf("rwset1=%s, rwset2=%s", spew.Sdump(rwset1), spew.Sdump(rwset2))
43-
testutil.AssertEquals(t, rwset1, rwset2)
43+
assert.Equal(t, rwset2, rwset1)
4444
}
4545

4646
// testPrepareBinaryFileSampleRWSetV1 constructs a proto message for kvrwset and marshals its bytes to file 'rwsetV1ProtoBytes'.
@@ -49,8 +49,8 @@ func TestRWSetV1BackwardCompatible(t *testing.T) {
4949
// using golang test framwork
5050
func testPrepareBinaryFileSampleRWSetV1(t *testing.T) {
5151
b, err := proto.Marshal(constructSampleRWSet())
52-
testutil.AssertNoError(t, err, "")
53-
testutil.AssertNoError(t, ioutil.WriteFile(binaryTestFileName, b, 0775), "")
52+
assert.NoError(t, err)
53+
assert.NoError(t, ioutil.WriteFile(binaryTestFileName, b, 0775))
5454
}
5555

5656
func constructSampleRWSet() *rwset.TxReadWriteSet {

0 commit comments

Comments
 (0)