mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-23 15:10:15 +00:00
Improvement: Speeding up slow tests (#707)
* Speeds up tests * Reduces time.Sleeps, lowers CreateTestBot complexity. Breaks things * Removal of unecessary config reads. Parallel tests. Lower times * Speeds up recent trades results * mini update * zoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom * Removes the dupes * Lint * post cherrypick * Fix rare kraken data race * Fixes banking global issues. Fixes postgres trades * rmline for appveyor test * Expands timeout in event that channel is closed before send * Fix data race * No rows, no bows and definitely no shows * Removes parallel from createsnapshot tests * Extends timedmutext test a smidge. Exchange fatality * Shorter end timeframe and bigger candle
This commit is contained in:
@@ -423,6 +423,7 @@ func TestOrderbookLastUpdateID(t *testing.T) {
|
||||
|
||||
// TestRunUpdateWithoutSnapshot logic test
|
||||
func TestRunUpdateWithoutSnapshot(t *testing.T) {
|
||||
t.Parallel()
|
||||
var holder Orderbook
|
||||
var snapShot1 orderbook.Base
|
||||
asks := []orderbook.Item{
|
||||
@@ -451,6 +452,7 @@ func TestRunUpdateWithoutSnapshot(t *testing.T) {
|
||||
|
||||
// TestRunUpdateWithoutAnyUpdates logic test
|
||||
func TestRunUpdateWithoutAnyUpdates(t *testing.T) {
|
||||
t.Parallel()
|
||||
var obl Orderbook
|
||||
var snapShot1 orderbook.Base
|
||||
snapShot1.Asks = []orderbook.Item{}
|
||||
@@ -472,6 +474,7 @@ func TestRunUpdateWithoutAnyUpdates(t *testing.T) {
|
||||
|
||||
// TestRunSnapshotWithNoData logic test
|
||||
func TestRunSnapshotWithNoData(t *testing.T) {
|
||||
t.Parallel()
|
||||
var obl Orderbook
|
||||
obl.ob = make(map[currency.Code]map[currency.Code]map[asset.Item]*orderbookHolder)
|
||||
obl.dataHandler = make(chan interface{}, 1)
|
||||
@@ -488,6 +491,7 @@ func TestRunSnapshotWithNoData(t *testing.T) {
|
||||
|
||||
// TestLoadSnapshot logic test
|
||||
func TestLoadSnapshot(t *testing.T) {
|
||||
t.Parallel()
|
||||
var obl Orderbook
|
||||
obl.dataHandler = make(chan interface{}, 100)
|
||||
obl.ob = make(map[currency.Code]map[currency.Code]map[asset.Item]*orderbookHolder)
|
||||
@@ -509,8 +513,8 @@ func TestLoadSnapshot(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestFlushbuffer logic test
|
||||
func TestFlushbuffer(t *testing.T) {
|
||||
// TestFlushBuffer logic test
|
||||
func TestFlushBuffer(t *testing.T) {
|
||||
obl, _, _, err := createSnapshot()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -526,6 +530,7 @@ func TestFlushbuffer(t *testing.T) {
|
||||
|
||||
// TestInsertingSnapShots logic test
|
||||
func TestInsertingSnapShots(t *testing.T) {
|
||||
t.Parallel()
|
||||
var holder Orderbook
|
||||
holder.dataHandler = make(chan interface{}, 100)
|
||||
holder.ob = make(map[currency.Code]map[currency.Code]map[asset.Item]*orderbookHolder)
|
||||
@@ -705,6 +710,7 @@ func TestGetOrderbook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetup(t *testing.T) {
|
||||
t.Parallel()
|
||||
w := Orderbook{}
|
||||
err := w.Setup(0, false, false, false, false, true, "", nil)
|
||||
if !errors.Is(err, errUnsetExchangeName) {
|
||||
@@ -736,6 +742,7 @@ func TestSetup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidate(t *testing.T) {
|
||||
t.Parallel()
|
||||
w := Orderbook{}
|
||||
err := w.validate(nil)
|
||||
if !errors.Is(err, errUpdateIsNil) {
|
||||
@@ -749,6 +756,7 @@ func TestValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnsureMultipleUpdatesViaPrice(t *testing.T) {
|
||||
t.Parallel()
|
||||
holder, _, _, err := createSnapshot()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@@ -782,6 +790,7 @@ func deploySliceOrdered(size int) orderbook.Items {
|
||||
}
|
||||
|
||||
func TestUpdateByIDAndAction(t *testing.T) {
|
||||
t.Parallel()
|
||||
holder := orderbookHolder{}
|
||||
|
||||
asks := deploySliceOrdered(100)
|
||||
@@ -990,6 +999,7 @@ func TestUpdateByIDAndAction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFlushOrderbook(t *testing.T) {
|
||||
t.Parallel()
|
||||
w := &Orderbook{}
|
||||
err := w.Setup(5, false, false, false, false, false, "test", make(chan interface{}, 2))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user