@@ -52,30 +52,6 @@ import (
5252 "github.com/algorand/go-algorand/util/db"
5353)
5454
55- // TestAccountsDbQueriesCreateClose tests to see that we can create the accountsDbQueries and close it.
56- // it also verify that double-closing it doesn't create an issue.
57- func TestAccountsDbQueriesCreateClose (t * testing.T ) {
58- partitiontest .PartitionTest (t )
59-
60- dbs , _ := storetesting .DbOpenTest (t , true )
61- storetesting .SetDbLogging (t , dbs )
62- defer dbs .Close ()
63-
64- err := dbs .Wdb .Atomic (func (ctx context.Context , tx * sql.Tx ) (err error ) {
65- accountsInitTest (t , tx , make (map [basics.Address ]basics.AccountData ), protocol .ConsensusCurrentVersion )
66- return nil
67- })
68- require .NoError (t , err )
69- qs , err := store .AccountsInitDbQueries (dbs .Rdb .Handle )
70- require .NoError (t , err )
71- // TODO[store-refactor]: internals are opaque, once we move the the remainder of accountdb we can mvoe this too
72- // require.NotNil(t, qs.listCreatablesStmt)
73- qs .Close ()
74- // require.Nil(t, qs.listCreatablesStmt)
75- qs .Close ()
76- // require.Nil(t, qs.listCreatablesStmt)
77- }
78-
7955func accountsInitTest (tb testing.TB , tx * sql.Tx , initAccounts map [basics.Address ]basics.AccountData , proto protocol.ConsensusVersion ) (newDatabase bool ) {
8056 newDB , err := accountsInit (tx , initAccounts , config .Consensus [proto ])
8157 require .NoError (tb , err )
@@ -988,6 +964,30 @@ func TestAccountsReencoding(t *testing.T) {
988964 require .NoError (t , err )
989965}
990966
967+ // TestAccountsDbQueriesCreateClose tests to see that we can create the accountsDbQueries and close it.
968+ // it also verify that double-closing it doesn't create an issue.
969+ func TestAccountsDbQueriesCreateClose (t * testing.T ) {
970+ partitiontest .PartitionTest (t )
971+
972+ dbs , _ := storetesting .DbOpenTest (t , true )
973+ storetesting .SetDbLogging (t , dbs )
974+ defer dbs .Close ()
975+
976+ err := dbs .Wdb .Atomic (func (ctx context.Context , tx * sql.Tx ) (err error ) {
977+ accountsInitTest (t , tx , make (map [basics.Address ]basics.AccountData ), protocol .ConsensusCurrentVersion )
978+ return nil
979+ })
980+ require .NoError (t , err )
981+ qs , err := store .AccountsInitDbQueries (dbs .Rdb .Handle )
982+ require .NoError (t , err )
983+ // TODO[store-refactor]: internals are opaque, once we move the the remainder of accountdb we can mvoe this too
984+ // require.NotNil(t, qs.listCreatablesStmt)
985+ qs .Close ()
986+ // require.Nil(t, qs.listCreatablesStmt)
987+ qs .Close ()
988+ // require.Nil(t, qs.listCreatablesStmt)
989+ }
990+
991991func benchmarkWriteCatchpointStagingBalancesSub (b * testing.B , ascendingOrder bool ) {
992992 proto := config .Consensus [protocol .ConsensusCurrentVersion ]
993993 genesisInitState , _ := ledgertesting .GenerateInitState (b , protocol .ConsensusCurrentVersion , 100 )
0 commit comments