linters: Exclude govet shadow check on exchange instances (#2097)

* Linters: Exclude govet shadow check on e in tests

* Linters: Remove nolint rule for new(Exchange) in tests

Replay with:
```
perl -pi -e 's{(\se\s:=\s.*?)\s*//nolint:govet // Intentional shadow.*}{$1}' **/*_test.go
```
This commit is contained in:
Gareth Kirwan
2025-10-29 05:30:23 +07:00
committed by GitHub
parent a7ff3efdcc
commit 5d6755b76e
23 changed files with 106 additions and 102 deletions

View File

@@ -1710,7 +1710,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
func TestUpdateAccountBalances(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
e := new(Exchange) //nolint:govet // Intentional shadow to avoid future copy/paste mistakes
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
items := asset.Items{
asset.CoinMarginedFutures,
@@ -1987,7 +1987,7 @@ func BenchmarkWsHandleData(bb *testing.B) {
func TestSubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
channels, err := e.generateSubscriptions() // Note: We grab this before it's overwritten by MockWsInstance below
require.NoError(t, err, "generateSubscriptions must not error")
@@ -2093,7 +2093,7 @@ func TestWsTradeUpdate(t *testing.T) {
func TestWsDepthUpdate(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.setupOrderbookManager(t.Context())
seedLastUpdateID := int64(161)
@@ -2459,7 +2459,7 @@ var websocketDepthUpdate = []byte(`{"E":1608001030784,"U":7145637266,"a":[["1945
func TestProcessOrderbookUpdate(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.setupOrderbookManager(t.Context())
p := currency.NewBTCUSDT()
@@ -2507,7 +2507,7 @@ func TestUFuturesHistoricalTrades(t *testing.T) {
func TestWsOrderExecutionReport(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
payload := []byte(`{"stream":"jTfvpakT2yT0hVIo5gYWVihZhdM2PrBgJUZ5PyfZ4EVpCkx4Uoxk5timcrQc","data":{"e":"executionReport","E":1616627567900,"s":"BTCUSDT","c":"c4wyKsIhoAaittTYlIVLqk","S":"BUY","o":"LIMIT","f":"GTC","q":"0.00028400","p":"52789.10000000","P":"0.00000000","F":"0.00000000","g":-1,"C":"","x":"NEW","X":"NEW","r":"NONE","i":5340845958,"l":"0.00000000","z":"0.00000000","L":"0.00000000","n":"0","N":"BTC","T":1616627567900,"t":-1,"I":11388173160,"w":true,"m":false,"M":false,"O":1616627567900,"Z":"0.00000000","Y":"0.00000000","Q":"0.00000000","W":1616627567900}}`)
// this is a buy BTC order, normally commission is charged in BTC, vice versa.

View File

@@ -509,7 +509,7 @@ func TestUpdateTicker(t *testing.T) {
func TestUpdateTickers(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
testexch.UpdatePairsOnce(t, e)
@@ -1137,7 +1137,7 @@ func TestWSAuth(t *testing.T) {
func TestGenerateSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
e.Websocket.SetCanUseAuthenticatedEndpoints(true)
require.True(t, e.Websocket.CanUseAuthenticatedEndpoints(), "CanUseAuthenticatedEndpoints must return true")
@@ -1183,7 +1183,7 @@ func TestGenerateSubscriptions(t *testing.T) {
// TestWSSubscribe tests Subscribe and Unsubscribe functionality
// See also TestSubscribeReq which covers key and symbol conversion
func TestWSSubscribe(t *testing.T) {
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "TestInstance must not error")
testexch.SetupWs(t, e)
err := e.Subscribe(subscription.List{{Channel: subscription.TickerChannel, Pairs: currency.Pairs{currency.NewBTCUSD()}, Asset: asset.Spot}})
@@ -1374,7 +1374,7 @@ func TestWSOrderBook(t *testing.T) {
func TestWSAllTrades(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Asset: asset.Spot, Pairs: currency.Pairs{btcusdPair}, Channel: subscription.AllTradesChannel, Key: 18788})
require.NoError(t, err, "AddSubscriptions must not error")

View File

@@ -201,7 +201,7 @@ func TestGetInsuranceFundHistory(t *testing.T) {
func TestGetLeaderboard(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
err := testexch.Setup(e)
require.NoError(t, err, "Setup must not error")
@@ -385,7 +385,7 @@ func TestGetStats(t *testing.T) {
func TestGetStatsHistorical(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
err := testexch.Setup(e)
require.NoError(t, err, "Setup must not error")
@@ -925,7 +925,7 @@ func TestWSDeleverageExecutionInsertHandling(t *testing.T) {
func TestWsTrades(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.SetSaveTradeDataStatus(true)
msg := []byte(`{"table":"trade","action":"insert","data":[{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.3,"tickDirection":"MinusTick","trdMatchID":"c427f7a0-6b26-1e10-5c4e-1bd74daf2a73","grossValue":2583000,"homeNotional":0.9904912836767037,"foreignNotional":255.84389857369254},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.3,"tickDirection":"ZeroMinusTick","trdMatchID":"95eb9155-b58c-70e9-44b7-34efe50302e0","grossValue":2583000,"homeNotional":0.9904912836767037,"foreignNotional":255.84389857369254},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.3,"tickDirection":"ZeroMinusTick","trdMatchID":"e607c187-f25c-86bc-cb39-8afff7aaf2d9","grossValue":2583000,"homeNotional":0.9904912836767037,"foreignNotional":255.84389857369254},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":17,"price":258.3,"tickDirection":"ZeroMinusTick","trdMatchID":"0f076814-a57d-9a59-8063-ad6b823a80ac","grossValue":439110,"homeNotional":0.1683835182250396,"foreignNotional":43.49346275752773},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.25,"tickDirection":"MinusTick","trdMatchID":"f4ef3dfd-51c4-538f-37c1-e5071ba1c75d","grossValue":2582500,"homeNotional":0.9904912836767037,"foreignNotional":255.79437400950872},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.25,"tickDirection":"ZeroMinusTick","trdMatchID":"81ef136b-8f4a-b1cf-78a8-fffbfa89bf40","grossValue":2582500,"homeNotional":0.9904912836767037,"foreignNotional":255.79437400950872},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.25,"tickDirection":"ZeroMinusTick","trdMatchID":"65a87e8c-7563-34a4-d040-94e8513c5401","grossValue":2582500,"homeNotional":0.9904912836767037,"foreignNotional":255.79437400950872},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":15,"price":258.25,"tickDirection":"ZeroMinusTick","trdMatchID":"1d11a74e-a157-3f33-036d-35a101fba50b","grossValue":387375,"homeNotional":0.14857369255150554,"foreignNotional":38.369156101426306},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":1,"price":258.25,"tickDirection":"ZeroMinusTick","trdMatchID":"40d49df1-f018-f66f-4ca5-31d4997641d7","grossValue":25825,"homeNotional":0.009904912836767036,"foreignNotional":2.5579437400950873},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.2,"tickDirection":"MinusTick","trdMatchID":"36135b51-73e5-c007-362b-a55be5830c6b","grossValue":2582000,"homeNotional":0.9904912836767037,"foreignNotional":255.7448494453249},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.2,"tickDirection":"ZeroMinusTick","trdMatchID":"6ee19edb-99aa-3030-ba63-933ffb347ade","grossValue":2582000,"homeNotional":0.9904912836767037,"foreignNotional":255.7448494453249},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":100,"price":258.2,"tickDirection":"ZeroMinusTick","trdMatchID":"d44be603-cdb8-d676-e3e2-f91fb12b2a70","grossValue":2582000,"homeNotional":0.9904912836767037,"foreignNotional":255.7448494453249},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":5,"price":258.2,"tickDirection":"ZeroMinusTick","trdMatchID":"a14b43b3-50b4-c075-c54d-dfb0165de33d","grossValue":129100,"homeNotional":0.04952456418383518,"foreignNotional":12.787242472266245},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":8,"price":258.2,"tickDirection":"ZeroMinusTick","trdMatchID":"3c30e175-5194-320c-8f8c-01636c2f4a32","grossValue":206560,"homeNotional":0.07923930269413629,"foreignNotional":20.45958795562599},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":50,"price":258.2,"tickDirection":"ZeroMinusTick","trdMatchID":"5b803378-760b-4919-21fc-bfb275d39ace","grossValue":1291000,"homeNotional":0.49524564183835185,"foreignNotional":127.87242472266244},{"timestamp":"2020-02-17T01:35:36.442Z","symbol":"ETHUSD","side":"Sell","size":244,"price":258.2,"tickDirection":"ZeroMinusTick","trdMatchID":"cf57fec1-c444-b9e5-5e2d-4fb643f4fdb7","grossValue":6300080,"homeNotional":2.416798732171157,"foreignNotional":624.0174326465927}]}`)

View File

@@ -741,7 +741,7 @@ func TestWsOrderbook2(t *testing.T) {
func TestWsOrderUpdate(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
testexch.FixtureToDataHandler(t, "testdata/wsMyOrders.json", e.wsHandleData)
close(e.Websocket.DataHandler)

View File

@@ -480,7 +480,7 @@ func TestWsTicker(t *testing.T) {
func TestWSTrade(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
fErrs := testexch.FixtureToDataHandlerWithErrors(t, "testdata/wsAllTrades.json", e.wsHandleData)
require.Equal(t, 2, len(fErrs), "Must get correct number of errors from wsHandleData")

View File

@@ -139,7 +139,7 @@ func TestFormatExchangeKlineInterval(t *testing.T) {
func TestGetHistoricCandles(t *testing.T) {
t.Parallel()
r := e.Requester
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test exchange Setup must not error")
e.Requester = r
start := time.Now().AddDate(0, 0, -3)
@@ -153,7 +153,7 @@ func TestGetHistoricCandles(t *testing.T) {
func TestGetHistoricCandlesExtended(t *testing.T) {
t.Parallel()
r := e.Requester
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test exchange Setup must not error")
e.Requester = r
err := e.CurrencyPairs.StorePairs(asset.Futures, currency.Pairs{futuresPair}, true)
@@ -469,7 +469,7 @@ func TestWsOrderbook(t *testing.T) {
func TestWSTrades(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
testexch.FixtureToDataHandler(t, "testdata/wsAllTrades.json", e.wsHandleData)
close(e.Websocket.DataHandler)
@@ -691,7 +691,7 @@ func TestIsPerpetualFutureCurrency(t *testing.T) {
func TestGetOpenInterest(t *testing.T) {
t.Parallel()
r := e.Requester
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test exchange Setup must not error")
testexch.UpdatePairsOnce(t, e)
e.Requester = r

View File

@@ -2784,7 +2784,7 @@ func TestUpdateAccountBalances(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
}
e := testInstance() //nolint:govet // Intentional shadow to avoid future copy/paste mistakes
e := testInstance()
subAccts, err := e.UpdateAccountBalances(t.Context(), asset.Spot)
require.NoError(t, err, "UpdateAccountBalances must not error")
@@ -2988,7 +2988,7 @@ var pushDataMap = map[string]string{
func TestWSHandleData(t *testing.T) {
t.Parallel()
e := testInstance() //nolint:govet // Intentional shadow to avoid future copy/paste mistakes
e := testInstance()
keys := slices.Collect(maps.Keys(pushDataMap))
slices.Sort(keys)
@@ -3011,7 +3011,7 @@ func TestWSHandleAuthenticatedData(t *testing.T) {
err = e.wsHandleAuthenticatedData(t.Context(), nil, []byte(`{"topic": "unhandled"}`))
require.ErrorIs(t, err, errUnhandledStreamData, "wsHandleAuthenticatedData must error for unhandled stream data")
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.API.AuthenticatedSupport = true
e.API.AuthenticatedWebsocketSupport = true
@@ -3159,7 +3159,7 @@ func TestWSHandleAuthenticatedData(t *testing.T) {
func TestWsTicker(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
assetRouting := []asset.Item{
asset.Spot, asset.Options, asset.USDTMarginedFutures, asset.USDTMarginedFutures,
@@ -3647,7 +3647,7 @@ func TestGetCurrencyTradeURL(t *testing.T) {
func TestGenerateSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.Websocket.SetCanUseAuthenticatedEndpoints(true)
@@ -3691,7 +3691,7 @@ func TestGenerateSubscriptions(t *testing.T) {
func TestAuthSubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
require.NoError(t, e.authSubscribe(t.Context(), &FixtureConnection{}, subscription.List{}))
@@ -3711,7 +3711,7 @@ func TestAuthSubscribe(t *testing.T) {
func TestWebsocketAuthenticatePrivateConnection(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e))
err := e.WebsocketAuthenticatePrivateConnection(t.Context(), &FixtureConnection{})
@@ -3730,7 +3730,7 @@ func TestWebsocketAuthenticatePrivateConnection(t *testing.T) {
func TestWebsocketAuthenticateTradeConnection(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e))
err := e.WebsocketAuthenticateTradeConnection(t.Context(), &FixtureConnection{})

View File

@@ -53,7 +53,7 @@ func TestWSCreateOrder(t *testing.T) {
require.ErrorIs(t, err, errInvalidTriggerPriceType)
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := getWebsocketInstance(t) //nolint:govet // Intentional shadow
e := getWebsocketInstance(t)
got, err := e.WSCreateOrder(t.Context(), &PlaceOrderRequest{
Category: cSpot,
Symbol: currency.NewBTCUSDT(),
@@ -84,7 +84,7 @@ func TestWebsocketSubmitOrder(t *testing.T) {
require.ErrorIs(t, err, order.ErrAmountMustBeSet)
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := getWebsocketInstance(t) //nolint:govet // Intentional shadow
e := getWebsocketInstance(t)
s.Type = order.Limit
s.Price = 55000
@@ -109,7 +109,7 @@ func TestWSAmendOrder(t *testing.T) {
require.ErrorIs(t, err, errEitherOrderIDOROrderLinkIDRequired)
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := getWebsocketInstance(t) //nolint:govet // Intentional shadow
e := getWebsocketInstance(t)
arg.OrderID = "1793353687809485568" // Replace with a valid order ID
arg.OrderQuantity = 0.0002
got, err := e.WSAmendOrder(t.Context(), arg)
@@ -127,7 +127,7 @@ func TestWebsocketModifyOrder(t *testing.T) {
}
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := getWebsocketInstance(t) //nolint:govet // Intentional shadow
e := getWebsocketInstance(t)
got, err := e.WebsocketModifyOrder(t.Context(), mod)
require.NoError(t, err)
@@ -162,7 +162,7 @@ func TestWSCancelOrder(t *testing.T) {
arg.OrderFilter = "Order"
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := getWebsocketInstance(t) //nolint:govet // Intentional shadow
e := getWebsocketInstance(t)
got, err := e.WSCancelOrder(t.Context(), arg)
require.NoError(t, err)
require.NotEmpty(t, got)
@@ -177,7 +177,7 @@ func TestWebsocketCancelOrder(t *testing.T) {
}
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := getWebsocketInstance(t) //nolint:govet // Intentional shadow
e := getWebsocketInstance(t)
err := e.WebsocketCancelOrder(t.Context(), cancel)
require.NoError(t, err)
@@ -194,7 +194,7 @@ func getWebsocketInstance(t *testing.T) *Exchange {
require.NoError(t, err)
pairs := &e.CurrencyPairs
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
e.SetDefaults()
bConf, err := cfg.GetExchangeConfig("Bybit")
require.NoError(t, err)

View File

@@ -11,7 +11,7 @@ import (
func TestGenerateInverseDefaultSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateInverseDefaultSubscriptions()
require.NoError(t, err, "GenerateInverseDefaultSubscriptions must not error")
@@ -31,7 +31,7 @@ func TestGenerateInverseDefaultSubscriptions(t *testing.T) {
func TestInverseSubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateInverseDefaultSubscriptions()
@@ -44,7 +44,7 @@ func TestInverseSubscribe(t *testing.T) {
func TestInverseUnsubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateInverseDefaultSubscriptions()

View File

@@ -15,7 +15,7 @@ func TestGenerateLinearDefaultSubscriptions(t *testing.T) {
_, err := e.GenerateLinearDefaultSubscriptions(asset.OptionCombo)
assert.ErrorIs(t, err, asset.ErrInvalidAsset)
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateLinearDefaultSubscriptions(asset.USDTMarginedFutures)
@@ -43,7 +43,7 @@ func TestGenerateLinearDefaultSubscriptions(t *testing.T) {
func TestLinearSubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateLinearDefaultSubscriptions(asset.USDTMarginedFutures)
@@ -60,7 +60,7 @@ func TestLinearSubscribe(t *testing.T) {
func TestLinearUnsubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateLinearDefaultSubscriptions(asset.USDTMarginedFutures)

View File

@@ -11,7 +11,7 @@ import (
func TestGenerateOptionsDefaultSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateOptionsDefaultSubscriptions()
require.NoError(t, err, "GenerateOptionsDefaultSubscriptions must not error")
@@ -31,7 +31,7 @@ func TestGenerateOptionsDefaultSubscriptions(t *testing.T) {
func TestOptionSubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateOptionsDefaultSubscriptions()
@@ -44,7 +44,7 @@ func TestOptionSubscribe(t *testing.T) {
func TestOptionsUnsubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateOptionsDefaultSubscriptions()

View File

@@ -1627,7 +1627,7 @@ func TestProcessSnapshotUpdate(t *testing.T) {
func TestGenerateSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow to avoid future copy/paste mistakes
e := new(Exchange)
if err := testexch.Setup(e); err != nil {
log.Fatal(err)
}
@@ -1674,7 +1674,7 @@ func TestSubscribeUnsubscribe(t *testing.T) {
func TestCheckSubscriptions(t *testing.T) {
t.Parallel()
e := &Exchange{ //nolint:govet // Intentional shadow to avoid future copy/paste mistakes
e := &Exchange{
Base: exchange.Base{
Config: &config.Exchange{
Features: &config.FeaturesConfig{

View File

@@ -733,7 +733,7 @@ func TestWSRetrieveLastTradesByInstrumentAndTime(t *testing.T) {
func TestWSProcessTrades(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup instance must not error")
testexch.FixtureToDataHandler(t, "testdata/wsAllTrades.json", e.wsHandleData)
close(e.Websocket.DataHandler)
@@ -3310,7 +3310,7 @@ func setupWs() {
func TestGenerateSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.Websocket.SetCanUseAuthenticatedEndpoints(true)

View File

@@ -2088,7 +2088,7 @@ func TestCrossMarginBalanceLoan(t *testing.T) {
// TestFuturesDataHandler ensures that messages from various futures channels do not error
func TestFuturesDataHandler(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
testexch.FixtureToDataHandler(t, "testdata/wsFutures.json", func(ctx context.Context, m []byte) error {
if strings.Contains(string(m), "futures.balances") {
@@ -2283,7 +2283,7 @@ func TestOptionsPongPushData(t *testing.T) {
func TestGenerateSubscriptionsSpot(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.Websocket.SetCanUseAuthenticatedEndpoints(true)
@@ -2343,7 +2343,7 @@ func TestGenerateDeliveryFuturesDefaultSubscriptions(t *testing.T) {
func TestGenerateFuturesDefaultSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.GenerateFuturesDefaultSubscriptions(asset.USDTMarginedFutures)
require.NoError(t, err)
@@ -3608,7 +3608,7 @@ func TestWebsocketSubmitOrders(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
sub.AssetType = asset.Spot
cpy.AssetType = asset.Spot

View File

@@ -31,7 +31,7 @@ func TestWebsocketFuturesSubmitOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
out.AutoSize = ""
got, err := e.WebsocketFuturesSubmitOrder(t.Context(), asset.USDTMarginedFutures, out)
@@ -73,7 +73,7 @@ func TestWebsocketFuturesSubmitOrders(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
// test single order
got, err := e.WebsocketFuturesSubmitOrders(t.Context(), asset.CoinMarginedFutures, out)
@@ -99,7 +99,7 @@ func TestWebsocketFuturesCancelOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
got, err := e.WebsocketFuturesCancelOrder(t.Context(), "513160761072", BTCUSDT, asset.USDTMarginedFutures)
require.NoError(t, err)
@@ -119,7 +119,7 @@ func TestWebsocketFuturesCancelAllOpenFuturesOrders(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
got, err := e.WebsocketFuturesCancelAllOpenFuturesOrders(t.Context(), BTCUSDT, asset.USDTMarginedFutures, order.Bid.Lower())
require.NoError(t, err)
@@ -151,7 +151,7 @@ func TestWebsocketFuturesAmendOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
amend.OrderID = "513170215869"
got, err := e.WebsocketFuturesAmendOrder(t.Context(), amend)
@@ -178,7 +178,7 @@ func TestWebsocketFuturesOrderList(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
list.Status = statusOpen
got, err := e.WebsocketFuturesOrderList(t.Context(), list)
@@ -199,7 +199,7 @@ func TestWebsocketFuturesGetOrderStatus(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.USDTMarginedFutures)
got, err := e.WebsocketFuturesGetOrderStatus(t.Context(), BTCUSDT, asset.USDTMarginedFutures, "513170215869")
require.NoError(t, err)

View File

@@ -20,7 +20,7 @@ func TestWebsocketLogin(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
c, err := e.Websocket.GetConnection(asset.Spot)
require.NoError(t, err)
@@ -50,7 +50,7 @@ func TestWebsocketSpotSubmitOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
got, err := e.WebsocketSpotSubmitOrder(t.Context(), out)
require.NoError(t, err)
@@ -78,7 +78,7 @@ func TestWebsocketSpotSubmitOrders(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
// test single order
got, err := e.WebsocketSpotSubmitOrders(t.Context(), out)
@@ -100,7 +100,7 @@ func TestWebsocketSpotCancelOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
got, err := e.WebsocketSpotCancelOrder(t.Context(), "644913098758", BTCUSDT, "")
require.NoError(t, err)
@@ -122,7 +122,7 @@ func TestWebsocketSpotCancelAllOrdersByIDs(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
out.OrderID = "644913101755"
got, err := e.WebsocketSpotCancelAllOrdersByIDs(t.Context(), []WebsocketOrderBatchRequest{out})
@@ -137,7 +137,7 @@ func TestWebsocketSpotCancelAllOrdersByPair(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
got, err := e.WebsocketSpotCancelAllOrdersByPair(t.Context(), currency.EMPTYPAIR, order.Buy, "")
require.NoError(t, err)
@@ -166,7 +166,7 @@ func TestWebsocketSpotAmendOrder(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
amend.OrderID = "645029162673"
got, err := e.WebsocketSpotAmendOrder(t.Context(), amend)
@@ -185,7 +185,7 @@ func TestWebsocketSpotGetOrderStatus(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e, canManipulateRealOrders)
testexch.UpdatePairsOnce(t, e)
e := newExchangeWithWebsocket(t, asset.Spot) //nolint:govet // Intentional shadow
e := newExchangeWithWebsocket(t, asset.Spot)
got, err := e.WebsocketSpotGetOrderStatus(t.Context(), "644999650452", BTCUSDT, "")
require.NoError(t, err)
@@ -199,7 +199,7 @@ func newExchangeWithWebsocket(t *testing.T, a asset.Item) *Exchange {
if apiKey == "" || apiSecret == "" {
t.Skip()
}
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
testexch.UpdatePairsOnce(t, e)
e.API.AuthenticatedSupport = true

View File

@@ -50,7 +50,7 @@ type websocketBalancesTest struct {
func TestProcessSpotBalances(t *testing.T) { //nolint:tparallel // Sequential tests, do not use t.Parallel(); Some timestamps are deliberately identical from trading activity
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
e.SetDefaults()
e.Name = "ProcessSpotBalancesTest"
e.Accounts = accounts.MustNewAccounts(e)
@@ -120,7 +120,7 @@ func TestProcessSpotBalances(t *testing.T) { //nolint:tparallel // Sequential te
func TestProcessBalancePushData(t *testing.T) { //nolint:tparallel // Sequential tests, do not use t.Parallel(); Some timestamps are deliberately identical from trading activity
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
e.SetDefaults()
e.Name = "ProcessFuturesBalancesTest"
e.Accounts = accounts.MustNewAccounts(e)

View File

@@ -853,7 +853,7 @@ func TestGetSpotKline(t *testing.T) {
func TestGetHistoricCandles(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
updatePairsOnce(t, e)
@@ -874,7 +874,7 @@ func TestGetHistoricCandles(t *testing.T) {
func TestGetHistoricCandlesExtended(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
updatePairsOnce(t, e)
@@ -1289,7 +1289,7 @@ func TestQueryWithdrawQuota(t *testing.T) {
func TestWSCandles(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Key: "market.btcusdt.kline.1min", Asset: asset.Spot, Pairs: currency.Pairs{btcusdtPair}, Channel: subscription.CandlesChannel})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1316,7 +1316,7 @@ func TestWSCandles(t *testing.T) {
func TestWSOrderbook(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Key: "market.btcusdt.depth.step0", Asset: asset.Spot, Pairs: currency.Pairs{btcusdtPair}, Channel: subscription.OrderbookChannel})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1344,7 +1344,7 @@ func TestWSOrderbook(t *testing.T) {
// TestWSHandleAllTradesMsg ensures wsHandleAllTrades sends trade.Data to the ws.DataHandler
func TestWSHandleAllTradesMsg(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Key: "market.btcusdt.trade.detail", Asset: asset.Spot, Pairs: currency.Pairs{btcusdtPair}, Channel: subscription.AllTradesChannel})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1390,7 +1390,7 @@ func TestWSHandleAllTradesMsg(t *testing.T) {
func TestWSTicker(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Key: "market.btcusdt.detail", Asset: asset.Spot, Pairs: currency.Pairs{btcusdtPair}, Channel: subscription.TickerChannel})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1419,7 +1419,7 @@ func TestWSTicker(t *testing.T) {
func TestWSAccountUpdate(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Key: "accounts.update#2", Asset: asset.Spot, Pairs: currency.Pairs{btcusdtPair}, Channel: subscription.MyAccountChannel})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1443,7 +1443,7 @@ func TestWSAccountUpdate(t *testing.T) {
func TestWSOrderUpdate(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Key: "orders#*", Asset: asset.Spot, Pairs: currency.Pairs{btcusdtPair}, Channel: subscription.MyOrdersChannel})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1509,7 +1509,7 @@ func TestWSOrderUpdate(t *testing.T) {
func TestWSMyTrades(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Key: "trade.clearing#btcusdt#1", Asset: asset.Spot, Pairs: currency.Pairs{btcusdtPair}, Channel: subscription.MyTradesChannel})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1722,7 +1722,7 @@ func TestGetFuturesContractDetails(t *testing.T) {
func TestGetLatestFundingRates(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test Instance Setup must not fail")
updatePairsOnce(t, e)
@@ -1815,7 +1815,7 @@ var expiryWindows = map[string]uint{
func TestPairFromContractExpiryCode(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test Instance Setup must not fail")
_, err := e.FetchTradablePairs(t.Context(), asset.Futures)
@@ -1927,7 +1927,7 @@ func TestGetCurrencyTradeURL(t *testing.T) {
func TestGenerateSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
e.Websocket.SetCanUseAuthenticatedEndpoints(true)
@@ -1994,7 +1994,7 @@ func wsFixture(tb testing.TB, msg []byte, w *gws.Conn) error {
// TestSubscribe exercises live public subscriptions
func TestSubscribe(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
subs, err := e.Features.Subscriptions.ExpandTemplates(e)
require.NoError(t, err, "ExpandTemplates must not error")

View File

@@ -117,7 +117,7 @@ func TestUpdateTicker(t *testing.T) {
func TestUpdateTickers(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
testexch.UpdatePairsOnce(t, e)
@@ -881,7 +881,7 @@ func TestWithdrawCancel(t *testing.T) {
// single pass, single fail, mixed fail, multiple pass, all fail
// No objection to this becoming a fixture test, so long as it integrates through Un/Subscribe roundtrip
func TestWsSubscribe(t *testing.T) {
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
testexch.SetupWs(t, e)
@@ -981,7 +981,7 @@ func TestWsSubscribe(t *testing.T) {
// TestWsResubscribe tests websocket resubscription
func TestWsResubscribe(t *testing.T) {
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "TestInstance must not error")
testexch.SetupWs(t, e)
@@ -1012,7 +1012,7 @@ func TestWsResubscribe(t *testing.T) {
func TestWsOrderbookSub(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
testexch.SetupWs(t, e)
@@ -1044,7 +1044,7 @@ func TestWsOrderbookSub(t *testing.T) {
func TestWsCandlesSub(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
testexch.SetupWs(t, e)
@@ -1078,7 +1078,7 @@ func TestWsOwnTradesSub(t *testing.T) {
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
testexch.SetupWs(t, e)
@@ -1129,7 +1129,7 @@ func TestGetWSToken(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCredentialsUnset(t, e)
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
testexch.SetupWs(t, e)
@@ -1180,7 +1180,7 @@ func TestWsCancelAllOrders(t *testing.T) {
func TestWsHandleData(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
for _, l := range []int{10, 100} {
err := e.Websocket.AddSuccessfulSubscriptions(e.Websocket.Conn, &subscription.Subscription{
@@ -1197,7 +1197,7 @@ func TestWsHandleData(t *testing.T) {
func TestWSProcessTrades(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
err := e.Websocket.AddSubscriptions(e.Websocket.Conn, &subscription.Subscription{Asset: asset.Spot, Pairs: currency.Pairs{spotTestPair}, Channel: subscription.AllTradesChannel, Key: 18788})
require.NoError(t, err, "AddSubscriptions must not error")
@@ -1234,7 +1234,7 @@ func TestWSProcessTrades(t *testing.T) {
func TestWsOpenOrders(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
testexch.UpdatePairsOnce(t, e)
testexch.FixtureToDataHandler(t, "testdata/wsOpenTrades.json", e.wsHandleData)
@@ -1443,7 +1443,7 @@ var websocketGSTEUROrderbookUpdates = []string{
func TestWsOrderbookMax10Depth(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup Instance must not error")
pairs := currency.Pairs{
currency.NewPairWithDelimiter("XDG", "USD", "/"),
@@ -1536,7 +1536,7 @@ func TestIsPerpetualFutureCurrency(t *testing.T) {
func TestGetOpenInterest(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
_, err := e.GetOpenInterest(t.Context(), key.PairAsset{

View File

@@ -2340,7 +2340,7 @@ func TestGetAuthenticatedServersInstances(t *testing.T) {
func TestPushData(t *testing.T) {
t.Parallel()
e := testInstance(t) //nolint:govet // Intentional shadow
e := testInstance(t)
e.SetCredentials("mock", "test", "test", "", "", "")
e.API.AuthenticatedSupport = true
e.API.AuthenticatedWebsocketSupport = true

View File

@@ -223,7 +223,7 @@ func TestGetWithdrawRecords(t *testing.T) {
func TestLoadPrivKey(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
e.SetDefaults()
require.ErrorIs(t, e.loadPrivKey(t.Context()), exchange.ErrCredentialsAreEmpty)
@@ -257,7 +257,7 @@ func TestLoadPrivKey(t *testing.T) {
func TestSign(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
e.SetDefaults()
_, err := e.sign("hello123")
require.ErrorIs(t, err, errPrivateKeyNotLoaded)

View File

@@ -3910,7 +3910,7 @@ func TestGenerateOrderbookChecksum(t *testing.T) {
func TestOrderPushData(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
testexch.FixtureToDataHandler(t, "testdata/wsOrders.json", e.WsHandleData)
close(e.Websocket.DataHandler)
@@ -4014,7 +4014,7 @@ var pushDataMap = map[string]string{
func TestWsHandleData(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
for name, msg := range pushDataMap {
@@ -4063,7 +4063,7 @@ func TestGetHistoricTrades(t *testing.T) {
func TestWSProcessTrades(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
assets, err := e.getAssetsFromInstrumentID(mainPair.String())
require.NoError(t, err, "getAssetsFromInstrumentID must not error")
@@ -4286,7 +4286,7 @@ func TestIsPerpetualFutureCurrency(t *testing.T) {
func TestGetAssetsFromInstrumentTypeOrID(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
_, err := e.getAssetsFromInstrumentID("")
@@ -6042,7 +6042,7 @@ func (e *Exchange) instrumentFamilyFromInstID(instrumentType, instID string) (st
func TestGenerateSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
e.Websocket.SetCanUseAuthenticatedEndpoints(true)
subs, err := e.generateSubscriptions()
@@ -6098,7 +6098,7 @@ func TestGenerateSubscriptions(t *testing.T) {
func TestBusinessWSCandleSubscriptions(t *testing.T) {
t.Parallel()
e := new(Exchange) //nolint:govet // Intentional shadow
e := new(Exchange)
require.NoError(t, testexch.Setup(e), "Setup must not error")
err := e.WsConnectBusiness(t.Context())