Skip to content

Commit

Permalink
[FAB-5143] Fix go-logging data races
Browse files Browse the repository at this point in the history
Change-Id: I0c6492ae9caba167ae3e341c02f2eea0812a4d6b
Signed-off-by: Divyank Katira <[email protected]>
  • Loading branch information
d1vyank committed Aug 15, 2017
1 parent 7fb8ad9 commit 2bbb512
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
api "github.com/hyperledger/fabric-sdk-go/api/apiconfig"
pkcsFactory "github.com/hyperledger/fabric/bccsp/factory"
pkcs11 "github.com/hyperledger/fabric/bccsp/pkcs11"
logging "github.com/op/go-logging"
"github.com/spf13/viper"
)

Expand Down Expand Up @@ -570,3 +571,18 @@ func TestInterfaces(t *testing.T) {
t.Fatalf("this shouldn't happen.")
}
}

// Test go-logging concurrency fix: If this test fails, the concurrency fix
// must be applied to go-logging. See: https://gerrit.hyperledger.org/r/12491
// for fix details.
func TestGoLoggingConcurrencyFix(t *testing.T) {
logger := logging.MustGetLogger("concurrencytest")
go func() {
for i := 0; i < 100; i++ {
logging.SetLevel(logging.Level(logging.DEBUG), "concurrencytest")
}
}()
for i := 0; i < 100; i++ {
logger.Info("testing")
}
}
6 changes: 6 additions & 0 deletions vendor/github.com/op/go-logging/backend.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/op/go-logging/level.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/op/go-logging/logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2bbb512

Please sign in to comment.