mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 23:16:51 +00:00
Tests: Various race fixes and move TestFixtureToDataHandler (#1534)
* Tests: Move and simplify TestFixtureToDataHandler * Currency: Fix PairsManager.Load breaking matcher * Tests: Add multi-instance cache to UpdatePairsOnce * Kraken: Fix TestUpdateTickers race error Calling StorePairs on global instance can lead to race * Bitfinex: Fix TestUpdateTickers racing intermittently * Currency: Fix concurrent access to PM formats * Currency: Fix SupportsAsset implementation This should delegate entirely to PairManager's IsAssetSupported * Okx: Fix PM intrusion, rm GetPairFromInstrumentID * Exchange: Fix SetGlobalPairsManager to set asset enabled * Bitflyer: Fix race on set TestGetCurrURL TestGetCurrencyTradeURL would fail sometimes due to sequencing of enabling futures but not having pairs for it. * Tests: Simplify usage pattern for FixtureToDH
This commit is contained in:
@@ -455,14 +455,14 @@ func TestUpdateTradablePairs(t *testing.T) {
|
||||
func TestGetCurrencyTradeURL(t *testing.T) {
|
||||
t.Parallel()
|
||||
testexch.UpdatePairsOnce(t, b)
|
||||
err := b.CurrencyPairs.SetAssetEnabled(asset.Futures, true)
|
||||
require.NoError(t, err)
|
||||
err := b.CurrencyPairs.SetAssetEnabled(asset.Futures, false)
|
||||
require.NoError(t, err, "SetAssetEnabled must not error")
|
||||
for _, a := range b.GetAssetTypes(false) {
|
||||
pairs, err := b.CurrencyPairs.GetPairs(a, false)
|
||||
require.NoError(t, err, "cannot get pairs for %s", a)
|
||||
require.NotEmpty(t, pairs, "no pairs for %s", a)
|
||||
resp, err := b.GetCurrencyTradeURL(context.Background(), a, pairs[0])
|
||||
require.NoError(t, err)
|
||||
assert.NotEmpty(t, resp)
|
||||
require.NoError(t, err, "GetCurrencyTradeURL must not error")
|
||||
assert.NotEmpty(t, resp, "GetCurrencyTradeURL should return an url")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user