Skip to content

Commit

Permalink
[FAB-10686] testutil->testify protos/ledger
Browse files Browse the repository at this point in the history
Change-Id: I3577dc937d58540c885c96e6f9d6b7883389f4db
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Sep 22, 2018
1 parent f80782b commit 6223621
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions protos/ledger/rwset/kvrwset/tests/kv_rwset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/davecgh/go-spew/spew"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/common/ledger/testutil"
"github.com/hyperledger/fabric/protos/ledger/rwset/kvrwset"
"github.com/stretchr/testify/assert"
)

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

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

func constructSampleKVRWSet() *kvrwset.KVRWSet {
Expand Down
12 changes: 6 additions & 6 deletions protos/ledger/rwset/tests/rwset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/davecgh/go-spew/spew"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/common/ledger/testutil"
"github.com/hyperledger/fabric/protos/ledger/rwset"
"github.com/stretchr/testify/assert"
)

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

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

func constructSampleRWSet() *rwset.TxReadWriteSet {
Expand Down

0 comments on commit 6223621

Please sign in to comment.