optimizing badger cache, won a 10-15% improvement in most benchmarks
This commit is contained in:
30
pkg/dgraph/testmain_test.go
Normal file
30
pkg/dgraph/testmain_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package dgraph
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"lol.mleku.dev"
|
||||
"lol.mleku.dev/log"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
// Disable all logging during tests unless explicitly enabled
|
||||
if os.Getenv("TEST_LOG") == "" {
|
||||
// Set log level to Off to suppress all logs
|
||||
lol.SetLogLevel("off")
|
||||
// Also redirect output to discard
|
||||
lol.Writer = io.Discard
|
||||
// Disable all log printers
|
||||
log.T = lol.GetNullPrinter()
|
||||
log.D = lol.GetNullPrinter()
|
||||
log.I = lol.GetNullPrinter()
|
||||
log.W = lol.GetNullPrinter()
|
||||
log.E = lol.GetNullPrinter()
|
||||
log.F = lol.GetNullPrinter()
|
||||
}
|
||||
|
||||
// Run tests
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
Reference in New Issue
Block a user