mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +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 api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -37,7 +38,8 @@ func TestLoadCandles(t *testing.T) {
|
||||
interval := gctkline.OneMin
|
||||
a := asset.Spot
|
||||
var data *gctkline.Item
|
||||
data, err = LoadData(common.DataCandle, tt1, tt2, interval.Duration(), exch, cp, a)
|
||||
data, err = LoadData(context.Background(),
|
||||
common.DataCandle, tt1, tt2, interval.Duration(), exch, cp, a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -45,7 +47,8 @@ func TestLoadCandles(t *testing.T) {
|
||||
t.Error("expected candles")
|
||||
}
|
||||
|
||||
_, err = LoadData(-1, tt1, tt2, interval.Duration(), exch, cp, a)
|
||||
_, err = LoadData(context.Background(),
|
||||
-1, tt1, tt2, interval.Duration(), exch, cp, a)
|
||||
if !errors.Is(err, common.ErrInvalidDataType) {
|
||||
t.Errorf("expected '%v' received '%v'", err, common.ErrInvalidDataType)
|
||||
}
|
||||
@@ -73,7 +76,8 @@ func TestLoadTrades(t *testing.T) {
|
||||
tt2 := time.Now().Round(interval.Duration())
|
||||
a := asset.Spot
|
||||
var data *gctkline.Item
|
||||
data, err = LoadData(common.DataTrade, tt1, tt2, interval.Duration(), exch, cp, a)
|
||||
data, err = LoadData(context.Background(),
|
||||
common.DataTrade, tt1, tt2, interval.Duration(), exch, cp, a)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user