Skip to content

Commit

Permalink
Remove dead code, add error checks to common
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm authored and Brett Logan committed May 23, 2020
1 parent 4e9790a commit 4f3146e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 0 additions & 3 deletions common/cauthdsl/cauthdsl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ func (md *mockDeserializer) DeserializeIdentity(serializedIdentity []byte) (msp.
return &mockIdentity{idBytes: serializedIdentity}, nil
}

var validSignature = []byte("signed")
var signers = [][]byte{[]byte("signer0"), []byte("signer1")}
var msgs = [][]byte{nil, nil}
var moreMsgs = [][]byte{nil, nil, nil}

func TestSimpleSignature(t *testing.T) {
policy := policydsl.Envelope(policydsl.SignedBy(0), signers)
Expand Down
8 changes: 5 additions & 3 deletions common/flogging/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ func TestObserverCheck(t *testing.T) {
checkedEntry := &zapcore.CheckedEntry{}

levels := &flogging.LoggerLevels{}
levels.ActivateSpec("debug")
err := levels.ActivateSpec("debug")
assert.NoError(t, err)
core := &flogging.Core{
LevelEnabler: zap.LevelEnablerFunc(func(l zapcore.Level) bool { return true }),
Levels: levels,
Expand Down Expand Up @@ -227,7 +228,8 @@ func TestObserverWriteEntry(t *testing.T) {
}

levels := &flogging.LoggerLevels{}
levels.ActivateSpec("debug")
err := levels.ActivateSpec("debug")
assert.NoError(t, err)
selector := &sw{}
output := &sw{}
core := &flogging.Core{
Expand All @@ -241,7 +243,7 @@ func TestObserverWriteEntry(t *testing.T) {
Observer: observer,
}

err := core.Write(entry, fields)
err = core.Write(entry, fields)
assert.NoError(t, err)

assert.Equal(t, 1, observer.WriteEntryCallCount())
Expand Down
5 changes: 3 additions & 2 deletions common/flogging/global_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import (

func TestGlobalReset(t *testing.T) {
flogging.Reset()
flogging.Global.SetFormat("json")
err := flogging.Global.ActivateSpec("logger=debug")
err := flogging.Global.SetFormat("json")
assert.NoError(t, err)
err = flogging.Global.ActivateSpec("logger=debug")
assert.NoError(t, err)

system, err := flogging.New(flogging.Config{})
Expand Down
3 changes: 2 additions & 1 deletion common/flogging/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func TestLoggingSetWriter(t *testing.T) {
original := logging.SetWriter(ws)

assert.Exactly(t, old, original)
logging.Write([]byte("hello"))
_, err = logging.Write([]byte("hello"))
assert.NoError(t, err)
assert.Equal(t, 1, ws.WriteCallCount())
assert.Equal(t, []byte("hello"), ws.WriteArgsForCall(0))

Expand Down

0 comments on commit 4f3146e

Please sign in to comment.