mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-08 15:11:07 +00:00
exchanges: Initial context propagation (#744)
* gct: phase one context awareness pass * exchanges: context propagation pass * common/requester: force context requirement * gctcli/exchanges: linter fix * rpcserver: fix test using dummy rpc server * backtester: fix comments * grpc: add correct cancel and timeout for commands * rpcserver_test: add comment on dummy server * common: deprecated SendHTTPGetRequest * linter: fix * linter: turn on no context check * apichecker: fix context linter issue * binance: use param context * common: remove checks as this gets executed before main * common: change mutex to RW as clients can be used by multiple go routines. * common: remove init and JIT default client. Unexport global variables and add protection. * common: Add comments * bithumb: after dinner mints fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -69,7 +70,7 @@ func TestSubmitWithdrawal(t *testing.T) {
|
||||
Bank: bank,
|
||||
},
|
||||
}
|
||||
_, err = m.SubmitWithdrawal(req)
|
||||
_, err = m.SubmitWithdrawal(context.Background(), req)
|
||||
if !errors.Is(err, common.ErrFunctionNotSupported) {
|
||||
t.Errorf("received %v, expected %v", err, common.ErrFunctionNotSupported)
|
||||
}
|
||||
@@ -77,7 +78,7 @@ func TestSubmitWithdrawal(t *testing.T) {
|
||||
req.Type = withdraw.Crypto
|
||||
req.Currency = currency.BTC
|
||||
req.Crypto.Address = "1337"
|
||||
_, err = m.SubmitWithdrawal(req)
|
||||
_, err = m.SubmitWithdrawal(context.Background(), req)
|
||||
if !errors.Is(err, withdraw.ErrStrAddressNotWhiteListed) {
|
||||
t.Errorf("received %v, expected %v", err, withdraw.ErrStrAddressNotWhiteListed)
|
||||
}
|
||||
@@ -95,24 +96,24 @@ func TestSubmitWithdrawal(t *testing.T) {
|
||||
if !errors.Is(err, nil) {
|
||||
t.Errorf("received %v, expected %v", err, nil)
|
||||
}
|
||||
_, err = m.SubmitWithdrawal(req)
|
||||
_, err = m.SubmitWithdrawal(context.Background(), req)
|
||||
if !errors.Is(err, withdraw.ErrStrExchangeNotSupportedByAddress) {
|
||||
t.Errorf("received %v, expected %v", err, withdraw.ErrStrExchangeNotSupportedByAddress)
|
||||
}
|
||||
|
||||
adds[0].SupportedExchanges = exchangeName
|
||||
_, err = m.SubmitWithdrawal(req)
|
||||
_, err = m.SubmitWithdrawal(context.Background(), req)
|
||||
if !errors.Is(err, exchange.ErrAuthenticatedRequestWithoutCredentialsSet) {
|
||||
t.Errorf("received %v, expected %v", err, exchange.ErrAuthenticatedRequestWithoutCredentialsSet)
|
||||
}
|
||||
|
||||
_, err = m.SubmitWithdrawal(nil)
|
||||
_, err = m.SubmitWithdrawal(context.Background(), nil)
|
||||
if !errors.Is(err, withdraw.ErrRequestCannotBeNil) {
|
||||
t.Errorf("received %v, expected %v", err, withdraw.ErrRequestCannotBeNil)
|
||||
}
|
||||
|
||||
m.isDryRun = true
|
||||
_, err = m.SubmitWithdrawal(req)
|
||||
_, err = m.SubmitWithdrawal(context.Background(), req)
|
||||
if !errors.Is(err, nil) {
|
||||
t.Errorf("received %v, expected %v", err, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user