exchanges: Fix GateIO/Coinbase test failures and OKX race (#1753)

* exchanges: Fix gateio/coinbase test failures

* OKX: Fix TestGetAssetsFromInstrumentTypeOrID race

* GateIO: Add/improve comments

* GateIO: Rid additional API call for FetchTradablePairs and provide additional context for test

* GateIO: Prompt test reviewers to take action if BTC settlement is supported again
This commit is contained in:
Adrian Gallagher
2024-12-20 12:07:46 +11:00
committed by GitHub
parent 16e5398dd5
commit 143e336c03
5 changed files with 115 additions and 178 deletions

View File

@@ -3,7 +3,6 @@ package coinbasepro
import (
"context"
"errors"
"log"
"net/http"
"os"
"testing"
@@ -14,7 +13,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/common/convert"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/core"
"github.com/thrasher-corp/gocryptotrader/currency"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
@@ -42,33 +40,11 @@ const (
canManipulateRealOrders = false
)
func TestMain(m *testing.M) {
c.SetDefaults()
cfg := config.GetConfig()
err := cfg.LoadConfig("../../testdata/configtest.json", true)
if err != nil {
log.Fatal("coinbasepro load config error", err)
}
gdxConfig, err := cfg.GetExchangeConfig("CoinbasePro")
if err != nil {
log.Fatal("coinbasepro Setup() init error")
}
gdxConfig.API.Credentials.Key = apiKey
gdxConfig.API.Credentials.Secret = apiSecret
gdxConfig.API.Credentials.ClientID = clientID
gdxConfig.API.AuthenticatedSupport = true
gdxConfig.API.AuthenticatedWebsocketSupport = true
c.Websocket = sharedtestvalues.NewTestWebsocket()
err = c.Setup(gdxConfig)
if err != nil {
log.Fatal("CoinbasePro setup error", err)
}
os.Exit(m.Run())
func TestMain(_ *testing.M) {
os.Exit(0) // Disable full test suite until PR #1381 is merged as more API endpoints have been deprecated over time
}
func TestGetProducts(t *testing.T) {
t.Skip("API is deprecated")
_, err := c.GetProducts(context.Background())
if err != nil {
t.Errorf("Coinbase, GetProducts() Error: %s", err)
@@ -76,8 +52,6 @@ func TestGetProducts(t *testing.T) {
}
func TestGetOrderbook(t *testing.T) {
t.Skip("API is deprecated")
_, err := c.GetOrderbook(context.Background(), testPair.String(), 2)
if err != nil {
t.Error(err)
@@ -89,8 +63,6 @@ func TestGetOrderbook(t *testing.T) {
}
func TestGetTicker(t *testing.T) {
t.Skip("API is deprecated")
_, err := c.GetTicker(context.Background(), testPair.String())
if err != nil {
t.Error("GetTicker() error", err)
@@ -105,8 +77,6 @@ func TestGetTrades(t *testing.T) {
}
func TestGetHistoricRatesGranularityCheck(t *testing.T) {
t.Skip("API is deprecated")
end := time.Now()
start := end.Add(-time.Hour * 2)
_, err := c.GetHistoricCandles(context.Background(),
@@ -117,8 +87,6 @@ func TestGetHistoricRatesGranularityCheck(t *testing.T) {
}
func TestCoinbasePro_GetHistoricCandlesExtended(t *testing.T) {
t.Skip("API is deprecated")
start := time.Unix(1546300800, 0)
end := time.Unix(1577836799, 0)