Files
gocryptotrader/database/models/sqlite3/boil_suites_test.go
Scott 197ef2df21 Feature: Data history manager engine subsystem (#693)
* Adds lovely initial concept for historical data doer

* Adds ability to save tasks. Adds config. Adds startStop to engine

* Has a database microservice without use of globals! Further infrastructure design. Adds readme

* Commentary to help design

* Adds migrations for database

* readme and adds database models

* Some modelling that doesn't work end of day

* Completes datahistoryjob sql.Begins datahistoryjobresult

* Adds datahistoryjob functions to retreive job results. Adapts subsystem

* Adds process for upserting jobs and job results to the database

* Broken end of day weird sqlboiler crap

* Fixes issue with SQL generation.

* RPC generation and addition of basic upsert command

* Renames types

* Adds rpc functions

* quick commit before context swithc. Exchanges aren't being populated

* Begin the tests!

* complete sql tests. stop failed jobs. CLI command creation

* Defines rpc commands

* Fleshes out RPC implementation

* Expands testing

* Expands testing, removes double remove

* Adds coverage of data history subsystem, expands errors and nil checks

* Minor logic improvement

* streamlines datahistory test setup

* End of day minor linting

* Lint, convert simplify, rpc expansion, type expansion, readme expansion

* Documentation update

* Renames for consistency

* Completes RPC server commands

* Fixes tests

* Speeds up testing by reducing unnecessary actions. Adds maxjobspercycle config

* Comments for everything

* Adds missing result string. checks interval supported. default start end cli

* Fixes ID problem. Improves binance trade fetch. job ranges are processed

* adds dbservice coverage. adds rpcserver coverage

* docs regen, uses dbcon interface, reverts binance, fixes races, toggle manager

* Speed up tests, remove bad global usage, fix uuid check

* Adds verbose. Updates docs. Fixes postgres

* Minor changes to logging and start stop

* Fixes postgres db tests, fixes postgres column typo

* Fixes old string typo,removes constraint,error parsing for nonreaders

* prevents dhm running when table doesn't exist. Adds prereq documentation

* Adds parallel, rmlines, err fix, comment fix, minor param fixes

* doc regen, common time range check and test updating

* Fixes job validation issues. Updates candle range checker.

* Ensures test cannot fail due to time.Now() shenanigans

* Fixes oopsie, adds documentation and a warn

* Fixes another time test, adjusts copy

* Drastically speeds up data history manager tests via function overrides

* Fixes summary bug and better logs

* Fixes local time test, fixes websocket tests

* removes defaults and comment,updates error messages,sets cli command args

* Fixes FTX trade processing

* Fixes issue where jobs got stuck if data wasn't returned but retrieval was successful

* Improves test speed. Simplifies trade verification SQL. Adds command help

* Fixes the oopsies

* Fixes use of query within transaction. Fixes trade err

* oopsie, not needed

* Adds missing data status. Properly ends job even when data is missing

* errors are more verbose and so have more words to describe them

* Doc regen for new status

* tiny test tinkering

* str := string("Removes .String()").String()

* Merge fixups

* Fixes a data race discovered during github actions

* Allows websocket test to pass consistently

* Fixes merge issue preventing datahistorymanager from starting via config

* Niterinos cmd defaults and explanations

* fixes default oopsie

* Fixes lack of nil protection

* Additional oopsie

* More detailed error for validating job exchange
2021-07-01 16:21:48 +10:00

340 lines
15 KiB
Go

// Code generated by SQLBoiler 3.5.0-gct (https://github.com/thrasher-corp/sqlboiler). DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.
package sqlite3
import "testing"
// This test suite runs each operation test in parallel.
// Example, if your database has 3 tables, the suite will run:
// table1, table2 and table3 Delete in parallel
// table1, table2 and table3 Insert in parallel, and so forth.
// It does NOT run each operation group in parallel.
// Separating the tests thusly grants avoidance of Postgres deadlocks.
func TestParent(t *testing.T) {
t.Run("AuditEvents", testAuditEvents)
t.Run("Candles", testCandles)
t.Run("Datahistoryjobs", testDatahistoryjobs)
t.Run("Datahistoryjobresults", testDatahistoryjobresults)
t.Run("Exchanges", testExchanges)
t.Run("Scripts", testScripts)
t.Run("ScriptExecutions", testScriptExecutions)
t.Run("Trades", testTrades)
t.Run("WithdrawalCryptos", testWithdrawalCryptos)
t.Run("WithdrawalFiats", testWithdrawalFiats)
t.Run("WithdrawalHistories", testWithdrawalHistories)
}
func TestDelete(t *testing.T) {
t.Run("AuditEvents", testAuditEventsDelete)
t.Run("Candles", testCandlesDelete)
t.Run("Datahistoryjobs", testDatahistoryjobsDelete)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsDelete)
t.Run("Exchanges", testExchangesDelete)
t.Run("Scripts", testScriptsDelete)
t.Run("ScriptExecutions", testScriptExecutionsDelete)
t.Run("Trades", testTradesDelete)
t.Run("WithdrawalCryptos", testWithdrawalCryptosDelete)
t.Run("WithdrawalFiats", testWithdrawalFiatsDelete)
t.Run("WithdrawalHistories", testWithdrawalHistoriesDelete)
}
func TestQueryDeleteAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsQueryDeleteAll)
t.Run("Candles", testCandlesQueryDeleteAll)
t.Run("Datahistoryjobs", testDatahistoryjobsQueryDeleteAll)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsQueryDeleteAll)
t.Run("Exchanges", testExchangesQueryDeleteAll)
t.Run("Scripts", testScriptsQueryDeleteAll)
t.Run("ScriptExecutions", testScriptExecutionsQueryDeleteAll)
t.Run("Trades", testTradesQueryDeleteAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosQueryDeleteAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsQueryDeleteAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesQueryDeleteAll)
}
func TestSliceDeleteAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsSliceDeleteAll)
t.Run("Candles", testCandlesSliceDeleteAll)
t.Run("Datahistoryjobs", testDatahistoryjobsSliceDeleteAll)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsSliceDeleteAll)
t.Run("Exchanges", testExchangesSliceDeleteAll)
t.Run("Scripts", testScriptsSliceDeleteAll)
t.Run("ScriptExecutions", testScriptExecutionsSliceDeleteAll)
t.Run("Trades", testTradesSliceDeleteAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosSliceDeleteAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsSliceDeleteAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesSliceDeleteAll)
}
func TestExists(t *testing.T) {
t.Run("AuditEvents", testAuditEventsExists)
t.Run("Candles", testCandlesExists)
t.Run("Datahistoryjobs", testDatahistoryjobsExists)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsExists)
t.Run("Exchanges", testExchangesExists)
t.Run("Scripts", testScriptsExists)
t.Run("ScriptExecutions", testScriptExecutionsExists)
t.Run("Trades", testTradesExists)
t.Run("WithdrawalCryptos", testWithdrawalCryptosExists)
t.Run("WithdrawalFiats", testWithdrawalFiatsExists)
t.Run("WithdrawalHistories", testWithdrawalHistoriesExists)
}
func TestFind(t *testing.T) {
t.Run("AuditEvents", testAuditEventsFind)
t.Run("Candles", testCandlesFind)
t.Run("Datahistoryjobs", testDatahistoryjobsFind)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsFind)
t.Run("Exchanges", testExchangesFind)
t.Run("Scripts", testScriptsFind)
t.Run("ScriptExecutions", testScriptExecutionsFind)
t.Run("Trades", testTradesFind)
t.Run("WithdrawalCryptos", testWithdrawalCryptosFind)
t.Run("WithdrawalFiats", testWithdrawalFiatsFind)
t.Run("WithdrawalHistories", testWithdrawalHistoriesFind)
}
func TestBind(t *testing.T) {
t.Run("AuditEvents", testAuditEventsBind)
t.Run("Candles", testCandlesBind)
t.Run("Datahistoryjobs", testDatahistoryjobsBind)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsBind)
t.Run("Exchanges", testExchangesBind)
t.Run("Scripts", testScriptsBind)
t.Run("ScriptExecutions", testScriptExecutionsBind)
t.Run("Trades", testTradesBind)
t.Run("WithdrawalCryptos", testWithdrawalCryptosBind)
t.Run("WithdrawalFiats", testWithdrawalFiatsBind)
t.Run("WithdrawalHistories", testWithdrawalHistoriesBind)
}
func TestOne(t *testing.T) {
t.Run("AuditEvents", testAuditEventsOne)
t.Run("Candles", testCandlesOne)
t.Run("Datahistoryjobs", testDatahistoryjobsOne)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsOne)
t.Run("Exchanges", testExchangesOne)
t.Run("Scripts", testScriptsOne)
t.Run("ScriptExecutions", testScriptExecutionsOne)
t.Run("Trades", testTradesOne)
t.Run("WithdrawalCryptos", testWithdrawalCryptosOne)
t.Run("WithdrawalFiats", testWithdrawalFiatsOne)
t.Run("WithdrawalHistories", testWithdrawalHistoriesOne)
}
func TestAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsAll)
t.Run("Candles", testCandlesAll)
t.Run("Datahistoryjobs", testDatahistoryjobsAll)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsAll)
t.Run("Exchanges", testExchangesAll)
t.Run("Scripts", testScriptsAll)
t.Run("ScriptExecutions", testScriptExecutionsAll)
t.Run("Trades", testTradesAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesAll)
}
func TestCount(t *testing.T) {
t.Run("AuditEvents", testAuditEventsCount)
t.Run("Candles", testCandlesCount)
t.Run("Datahistoryjobs", testDatahistoryjobsCount)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsCount)
t.Run("Exchanges", testExchangesCount)
t.Run("Scripts", testScriptsCount)
t.Run("ScriptExecutions", testScriptExecutionsCount)
t.Run("Trades", testTradesCount)
t.Run("WithdrawalCryptos", testWithdrawalCryptosCount)
t.Run("WithdrawalFiats", testWithdrawalFiatsCount)
t.Run("WithdrawalHistories", testWithdrawalHistoriesCount)
}
func TestHooks(t *testing.T) {
t.Run("AuditEvents", testAuditEventsHooks)
t.Run("Candles", testCandlesHooks)
t.Run("Datahistoryjobs", testDatahistoryjobsHooks)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsHooks)
t.Run("Exchanges", testExchangesHooks)
t.Run("Scripts", testScriptsHooks)
t.Run("ScriptExecutions", testScriptExecutionsHooks)
t.Run("Trades", testTradesHooks)
t.Run("WithdrawalCryptos", testWithdrawalCryptosHooks)
t.Run("WithdrawalFiats", testWithdrawalFiatsHooks)
t.Run("WithdrawalHistories", testWithdrawalHistoriesHooks)
}
func TestInsert(t *testing.T) {
t.Run("AuditEvents", testAuditEventsInsert)
t.Run("AuditEvents", testAuditEventsInsertWhitelist)
t.Run("Candles", testCandlesInsert)
t.Run("Candles", testCandlesInsertWhitelist)
t.Run("Datahistoryjobs", testDatahistoryjobsInsert)
t.Run("Datahistoryjobs", testDatahistoryjobsInsertWhitelist)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsInsert)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsInsertWhitelist)
t.Run("Exchanges", testExchangesInsert)
t.Run("Exchanges", testExchangesInsertWhitelist)
t.Run("Scripts", testScriptsInsert)
t.Run("Scripts", testScriptsInsertWhitelist)
t.Run("ScriptExecutions", testScriptExecutionsInsert)
t.Run("ScriptExecutions", testScriptExecutionsInsertWhitelist)
t.Run("Trades", testTradesInsert)
t.Run("Trades", testTradesInsertWhitelist)
t.Run("WithdrawalCryptos", testWithdrawalCryptosInsert)
t.Run("WithdrawalCryptos", testWithdrawalCryptosInsertWhitelist)
t.Run("WithdrawalFiats", testWithdrawalFiatsInsert)
t.Run("WithdrawalFiats", testWithdrawalFiatsInsertWhitelist)
t.Run("WithdrawalHistories", testWithdrawalHistoriesInsert)
t.Run("WithdrawalHistories", testWithdrawalHistoriesInsertWhitelist)
}
// TestToOne tests cannot be run in parallel
// or deadlocks can occur.
func TestToOne(t *testing.T) {
t.Run("CandleToExchangeUsingExchangeName", testCandleToOneExchangeUsingExchangeName)
t.Run("DatahistoryjobToExchangeUsingExchangeName", testDatahistoryjobToOneExchangeUsingExchangeName)
t.Run("DatahistoryjobresultToDatahistoryjobUsingJob", testDatahistoryjobresultToOneDatahistoryjobUsingJob)
t.Run("ScriptExecutionToScriptUsingScript", testScriptExecutionToOneScriptUsingScript)
t.Run("TradeToExchangeUsingExchangeName", testTradeToOneExchangeUsingExchangeName)
t.Run("WithdrawalCryptoToWithdrawalHistoryUsingWithdrawalHistory", testWithdrawalCryptoToOneWithdrawalHistoryUsingWithdrawalHistory)
t.Run("WithdrawalFiatToWithdrawalHistoryUsingWithdrawalHistory", testWithdrawalFiatToOneWithdrawalHistoryUsingWithdrawalHistory)
t.Run("WithdrawalHistoryToExchangeUsingExchangeName", testWithdrawalHistoryToOneExchangeUsingExchangeName)
}
// TestOneToOne tests cannot be run in parallel
// or deadlocks can occur.
func TestOneToOne(t *testing.T) {
t.Run("ExchangeToCandleUsingExchangeNameCandle", testExchangeOneToOneCandleUsingExchangeNameCandle)
t.Run("ExchangeToTradeUsingExchangeNameTrade", testExchangeOneToOneTradeUsingExchangeNameTrade)
}
// TestToMany tests cannot be run in parallel
// or deadlocks can occur.
func TestToMany(t *testing.T) {
t.Run("DatahistoryjobToJobDatahistoryjobresults", testDatahistoryjobToManyJobDatahistoryjobresults)
t.Run("ExchangeToExchangeNameDatahistoryjobs", testExchangeToManyExchangeNameDatahistoryjobs)
t.Run("ExchangeToExchangeNameWithdrawalHistories", testExchangeToManyExchangeNameWithdrawalHistories)
t.Run("ScriptToScriptExecutions", testScriptToManyScriptExecutions)
t.Run("WithdrawalHistoryToWithdrawalCryptos", testWithdrawalHistoryToManyWithdrawalCryptos)
t.Run("WithdrawalHistoryToWithdrawalFiats", testWithdrawalHistoryToManyWithdrawalFiats)
}
// TestToOneSet tests cannot be run in parallel
// or deadlocks can occur.
func TestToOneSet(t *testing.T) {
t.Run("CandleToExchangeUsingExchangeNameCandle", testCandleToOneSetOpExchangeUsingExchangeName)
t.Run("DatahistoryjobToExchangeUsingExchangeNameDatahistoryjobs", testDatahistoryjobToOneSetOpExchangeUsingExchangeName)
t.Run("DatahistoryjobresultToDatahistoryjobUsingJobDatahistoryjobresults", testDatahistoryjobresultToOneSetOpDatahistoryjobUsingJob)
t.Run("ScriptExecutionToScriptUsingScriptExecutions", testScriptExecutionToOneSetOpScriptUsingScript)
t.Run("TradeToExchangeUsingExchangeNameTrade", testTradeToOneSetOpExchangeUsingExchangeName)
t.Run("WithdrawalCryptoToWithdrawalHistoryUsingWithdrawalCryptos", testWithdrawalCryptoToOneSetOpWithdrawalHistoryUsingWithdrawalHistory)
t.Run("WithdrawalFiatToWithdrawalHistoryUsingWithdrawalFiats", testWithdrawalFiatToOneSetOpWithdrawalHistoryUsingWithdrawalHistory)
t.Run("WithdrawalHistoryToExchangeUsingExchangeNameWithdrawalHistories", testWithdrawalHistoryToOneSetOpExchangeUsingExchangeName)
}
// TestToOneRemove tests cannot be run in parallel
// or deadlocks can occur.
func TestToOneRemove(t *testing.T) {}
// TestOneToOneSet tests cannot be run in parallel
// or deadlocks can occur.
func TestOneToOneSet(t *testing.T) {
t.Run("ExchangeToCandleUsingExchangeNameCandle", testExchangeOneToOneSetOpCandleUsingExchangeNameCandle)
t.Run("ExchangeToTradeUsingExchangeNameTrade", testExchangeOneToOneSetOpTradeUsingExchangeNameTrade)
}
// TestOneToOneRemove tests cannot be run in parallel
// or deadlocks can occur.
func TestOneToOneRemove(t *testing.T) {}
// TestToManyAdd tests cannot be run in parallel
// or deadlocks can occur.
func TestToManyAdd(t *testing.T) {
t.Run("DatahistoryjobToJobDatahistoryjobresults", testDatahistoryjobToManyAddOpJobDatahistoryjobresults)
t.Run("ExchangeToExchangeNameDatahistoryjobs", testExchangeToManyAddOpExchangeNameDatahistoryjobs)
t.Run("ExchangeToExchangeNameWithdrawalHistories", testExchangeToManyAddOpExchangeNameWithdrawalHistories)
t.Run("ScriptToScriptExecutions", testScriptToManyAddOpScriptExecutions)
t.Run("WithdrawalHistoryToWithdrawalCryptos", testWithdrawalHistoryToManyAddOpWithdrawalCryptos)
t.Run("WithdrawalHistoryToWithdrawalFiats", testWithdrawalHistoryToManyAddOpWithdrawalFiats)
}
// TestToManySet tests cannot be run in parallel
// or deadlocks can occur.
func TestToManySet(t *testing.T) {}
// TestToManyRemove tests cannot be run in parallel
// or deadlocks can occur.
func TestToManyRemove(t *testing.T) {}
func TestReload(t *testing.T) {
t.Run("AuditEvents", testAuditEventsReload)
t.Run("Candles", testCandlesReload)
t.Run("Datahistoryjobs", testDatahistoryjobsReload)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsReload)
t.Run("Exchanges", testExchangesReload)
t.Run("Scripts", testScriptsReload)
t.Run("ScriptExecutions", testScriptExecutionsReload)
t.Run("Trades", testTradesReload)
t.Run("WithdrawalCryptos", testWithdrawalCryptosReload)
t.Run("WithdrawalFiats", testWithdrawalFiatsReload)
t.Run("WithdrawalHistories", testWithdrawalHistoriesReload)
}
func TestReloadAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsReloadAll)
t.Run("Candles", testCandlesReloadAll)
t.Run("Datahistoryjobs", testDatahistoryjobsReloadAll)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsReloadAll)
t.Run("Exchanges", testExchangesReloadAll)
t.Run("Scripts", testScriptsReloadAll)
t.Run("ScriptExecutions", testScriptExecutionsReloadAll)
t.Run("Trades", testTradesReloadAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosReloadAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsReloadAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesReloadAll)
}
func TestSelect(t *testing.T) {
t.Run("AuditEvents", testAuditEventsSelect)
t.Run("Candles", testCandlesSelect)
t.Run("Datahistoryjobs", testDatahistoryjobsSelect)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsSelect)
t.Run("Exchanges", testExchangesSelect)
t.Run("Scripts", testScriptsSelect)
t.Run("ScriptExecutions", testScriptExecutionsSelect)
t.Run("Trades", testTradesSelect)
t.Run("WithdrawalCryptos", testWithdrawalCryptosSelect)
t.Run("WithdrawalFiats", testWithdrawalFiatsSelect)
t.Run("WithdrawalHistories", testWithdrawalHistoriesSelect)
}
func TestUpdate(t *testing.T) {
t.Run("AuditEvents", testAuditEventsUpdate)
t.Run("Candles", testCandlesUpdate)
t.Run("Datahistoryjobs", testDatahistoryjobsUpdate)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsUpdate)
t.Run("Exchanges", testExchangesUpdate)
t.Run("Scripts", testScriptsUpdate)
t.Run("ScriptExecutions", testScriptExecutionsUpdate)
t.Run("Trades", testTradesUpdate)
t.Run("WithdrawalCryptos", testWithdrawalCryptosUpdate)
t.Run("WithdrawalFiats", testWithdrawalFiatsUpdate)
t.Run("WithdrawalHistories", testWithdrawalHistoriesUpdate)
}
func TestSliceUpdateAll(t *testing.T) {
t.Run("AuditEvents", testAuditEventsSliceUpdateAll)
t.Run("Candles", testCandlesSliceUpdateAll)
t.Run("Datahistoryjobs", testDatahistoryjobsSliceUpdateAll)
t.Run("Datahistoryjobresults", testDatahistoryjobresultsSliceUpdateAll)
t.Run("Exchanges", testExchangesSliceUpdateAll)
t.Run("Scripts", testScriptsSliceUpdateAll)
t.Run("ScriptExecutions", testScriptExecutionsSliceUpdateAll)
t.Run("Trades", testTradesSliceUpdateAll)
t.Run("WithdrawalCryptos", testWithdrawalCryptosSliceUpdateAll)
t.Run("WithdrawalFiats", testWithdrawalFiatsSliceUpdateAll)
t.Run("WithdrawalHistories", testWithdrawalHistoriesSliceUpdateAll)
}