Skip to content

Commit

Permalink
Capture flogging output in integration tests
Browse files Browse the repository at this point in the history
Two suites use fabric packages instead of command line tools to interact
with the network. This pattern results in log output going to Stderr
instead of to GinkgoWriter. This means two things:

1. There's a bunch of logging that gets printed when running the tests
   that is intermingled with the test runner outout.
2. The log output is not captured in the GinkgoWriter associated with
   the test. Prevents time-ordered correlation of activities when
   failures occur.

Address this by setting the GinkgoWriter as the flogging package writer
in the test suite processes.

Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com>
  • Loading branch information
sykesm authored and Brett Logan committed Apr 18, 2020
1 parent 9ccf752 commit f69dc30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions integration/lifecycle/lifecycle_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
pcommon "github.com/hyperledger/fabric-protos-go/common"
pb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric/bccsp/sw"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/integration"
"github.com/hyperledger/fabric/integration/nwo"
"github.com/hyperledger/fabric/integration/nwo/commands"
Expand Down Expand Up @@ -58,6 +59,8 @@ var _ = SynchronizedBeforeSuite(func() []byte {
}, func(payload []byte) {
err := json.Unmarshal(payload, &components)
Expect(err).NotTo(HaveOccurred())

flogging.SetWriter(GinkgoWriter)
})

var _ = SynchronizedAfterSuite(func() {
Expand Down
3 changes: 3 additions & 0 deletions integration/raft/raft_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"fmt"
"testing"

"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/integration"
"github.com/hyperledger/fabric/integration/nwo"
"github.com/hyperledger/fabric/integration/nwo/commands"
Expand Down Expand Up @@ -42,6 +43,8 @@ var _ = SynchronizedBeforeSuite(func() []byte {
}, func(payload []byte) {
err := json.Unmarshal(payload, &components)
Expect(err).NotTo(HaveOccurred())

flogging.SetWriter(GinkgoWriter)
})

var _ = SynchronizedAfterSuite(func() {
Expand Down

0 comments on commit f69dc30

Please sign in to comment.