From f69dc30059f6aa26c35ab934d5dc5e837eba7a79 Mon Sep 17 00:00:00 2001 From: Matthew Sykes Date: Sat, 18 Apr 2020 16:01:48 +0000 Subject: [PATCH] Capture flogging output in integration tests 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 --- integration/lifecycle/lifecycle_suite_test.go | 3 +++ integration/raft/raft_suite_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/integration/lifecycle/lifecycle_suite_test.go b/integration/lifecycle/lifecycle_suite_test.go index 53fc858be16..1ac8dddd2d4 100644 --- a/integration/lifecycle/lifecycle_suite_test.go +++ b/integration/lifecycle/lifecycle_suite_test.go @@ -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" @@ -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() { diff --git a/integration/raft/raft_suite_test.go b/integration/raft/raft_suite_test.go index d8eaed8b815..5516aa9c269 100644 --- a/integration/raft/raft_suite_test.go +++ b/integration/raft/raft_suite_test.go @@ -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" @@ -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() {