mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* Binance: Fix subscription failures ignored * Testing: Fix race on shared config singleton * Config: Privatise Global config var We should *either* use a private var *or* use an accessor, but it doesn't make sense to mix paradigms. Since GetConfig() is well established this instead removes the limited uses of direct public access and adds a Setter * Zip: Fix test failure on http mocks
39 lines
706 B
Go
39 lines
706 B
Go
//go:build !mock_test_off
|
|
|
|
// This will build if build tag mock_test_off is not parsed and will try to mock
|
|
// all tests in _test.go
|
|
package binance
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
testexch "github.com/thrasher-corp/gocryptotrader/internal/testing/exchange"
|
|
)
|
|
|
|
var mockTests = true
|
|
|
|
func TestMain(m *testing.M) {
|
|
if useTestNet {
|
|
log.Fatal("cannot use testnet with mock tests")
|
|
}
|
|
|
|
b = new(Binance)
|
|
if err := testexch.TestInstance(b); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if err := testexch.MockHTTPInstance(b); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
b.setupOrderbookManager()
|
|
if err := b.UpdateTradablePairs(context.Background(), true); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
os.Exit(m.Run())
|
|
}
|