Dave Collins
3b56ccaff7
Add interface test for NewestSha.
2013-10-15 10:22:46 -05:00
Dave Collins
0c8a15a9d5
Add tests to verify integrity after clearing cache.
...
This commit adds the infrastructure needed to re-run the integrity tests
after calling the InvalidBlockCache, InvalidateTxCache, and
InvalidateCache functions. The tests intentially randomize the order the
invalidate functions are called in to increase the likelyhood of finding
in issues realted to ordering of the calls.
2013-10-14 20:37:58 -05:00
Dave Collins
54ad820133
Combine two test functions used to fetch tx lists.
...
The two functions are nearly identical, so rather than repeating the
test code, refactor it into a separate function that takes a flag.
2013-10-14 19:26:23 -05:00
Dave Collins
a9d719f0c4
Separate interface integrity tests.
...
This paves the way for executing the integrity tests multiple times.
2013-10-14 18:31:01 -05:00
Dave Collins
9ec86518ac
Improve interface test error messages.
...
This commit changes the interface test errors to all report the block
height and hash prior to the failure. Test failures that transactions
also now report the transaction number and hash. The makes it much
easier to track down where a test failure occurs.
2013-10-14 18:27:12 -05:00
Dave Collins
c99416c121
Include db type in interface tests loading message.
2013-10-14 14:35:10 -05:00
Dave Collins
01af05c8ac
Add interface tests for FetchUnSpentTxByShaList.
2013-10-14 13:56:21 -05:00
Dave Collins
2ab3e0a382
Add interface tests for FetchTxByShaList.
2013-10-14 13:49:52 -05:00
Dave Collins
fb5f9c0b5a
Separate interface tests and add test context.
...
Rather than having one mammoth interface test function, create a test
context and several helper functions that accept the context.
2013-10-14 12:26:43 -05:00
Dave Collins
06cb2ec817
Add interface test for FetchTxBySha.
...
This commit adds an interface test for FetchTxBySha to ensure it returns
the same MsgTx that was part of an inserted block.
2013-10-14 12:26:43 -05:00
Dave Collins
6a3824b8aa
Add interface test for ExistsTxSha.
...
This commit adds an interface test for ExistsTxSha to ensure all
transactions inserted as a part of a block are available.
2013-10-14 12:26:42 -05:00
Dave Collins
f37fabb855
Add negative tests for FetchBlockShaByHeight.
...
This commit adds tests to ensure FetchBlockShaByHeight returns expected
errors when invalid heights are specified.
2013-10-14 12:26:41 -05:00
Dave Collins
06d6e5fce8
Add db type to test error outputs.
2013-10-14 12:26:40 -05:00
Dave Collins
6eebf02183
Add interface test for FetchBlockShaByHeight.
...
This commit adds an interface test for FetchBlockShaByHeight to ensure it
returns the same expected hash for each block inserted block height.
2013-10-14 12:26:40 -05:00
Dave Collins
670d83a74e
Improve error message for FetchBlockBySha test.wq
2013-10-14 12:26:39 -05:00
Dave Collins
396d1b056d
Add interface test for FetchBlockBySha.
...
This commit adds an interface test for FetchBlockBySha to ensure it
returns the same MsgBlock and raw bytes that were inserted.
2013-10-14 12:26:38 -05:00
Dave Collins
2d84623493
Move non-interface specific tests into db_test.go.
...
The idea here is that interface_test.go will be directly usable in each
implementation to increase test coverage there as well, but also works at
the top-most level to test arbitrary backends.
2013-10-14 12:26:37 -05:00
Dave Collins
ff429203c4
Start interface tests that require state.
2013-10-14 12:26:37 -05:00
Dave Collins
82d1898b12
Add interface test for unsupported dbtype failures.
...
This commit adds an interface test to ensure that the interface returns
the expected error when trying to open or create an unsupported database
type.
2013-10-14 12:26:36 -05:00
Dave Collins
d4c1214496
Add interface test for create and open failures.
...
This commit adds an interface test to ensure that failures which occur
while creating or opening a database are properly handled.
2013-10-14 12:26:35 -05:00
Dave Collins
53ea2cf0ba
Add interface test for adding a duplicate driver.
...
This commit adds an interface test to ensure that attempting to add a
duplicate driver for a given database type does not overwrite an existing
one.
2013-10-14 12:26:34 -05:00
Dave Collins
562294f938
Add loadBlocks infrastructure to interface tests.
2013-10-14 12:26:34 -05:00
Dave Collins
a27c37793b
Add basic infrastructure for interface tests.
...
This is simply at start at providing generic interface tests. The only
thing is tests so far is the empty database conditions on NewestSha, but
it adds infrastructure for creating and opening databases with special
type handling based on the database and necessary logic to teardown so
multiple backends can be tested simultaneously.
This and the next series of commits all discussed with drahn@.
2013-10-14 12:26:12 -05:00
Dale Rahn
75896b63ec
Add Api to fetch potentially fully spent tx (most recent only)
...
Using FetchUnSpentTxByShaList only API required unexpected contortions
in btcchain.
2013-10-13 14:58:32 -04:00
Dave Collins
2ec9511891
Go fmt.
2013-10-13 13:04:16 -05:00
Dave Collins
1f87ee217a
Move testdata to root btcd directory.
...
Rather than duplicating the same data, just put it under testsdata at the
root and access it from the modules from the parent directory.
2013-10-12 01:49:57 -05:00
Dale Rahn
6260dc959d
When creating database, set version 1 so the correct options are set.
2013-10-11 09:44:09 -04:00
Dave Collins
e4d3f25991
Update imports for goleveldb to Conformal fork.
2013-10-04 11:41:00 -05:00
Dale Rahn
cda0b10082
Introduce an API change for btcdb
...
FetchTxBySha changes what it returns, it can now return a TxListReply and
and error if none are found.
FetchTxByShaList is renamed to FetchUnSpentTxByShaList to indicate that
it will (likey/eventually) only return Tx that have some unspent TxOuts.
Tx which are fully spent may not be (reliably) looked up using this API.
2013-10-03 16:51:34 -04:00
Dale Rahn
07d634c76a
remove old API function.
2013-10-03 14:08:04 -04:00
Dale Rahn
78d4bfecd4
Remove obsolete API functions
2013-10-03 14:08:04 -04:00
David Hill
9abf071308
increase default pagesize to 4096 on sqlite
2013-10-03 10:32:19 -04:00
Dale Rahn
63f8993163
Delete testing operations from obsolete functions.
2013-10-02 18:10:00 -04:00
Dale Rahn
8d1db93c82
Remove unused interfaces.
2013-10-02 17:24:26 -04:00
Marco Peereboom
e840c8314c
catch up with api changes
2013-09-26 10:15:14 -05:00
Dale Rahn
3640f6d37c
Version the leveldb (and keep compatibility with pre-versioned uncompressed databases.
2013-09-25 17:23:34 -04:00
Marco Peereboom
0e98349c98
disable compression, don't use cache and limit open files
2013-09-25 17:23:33 -04:00
David Hill
18b3e86179
FetchTxAllBySha needs to return err to the caller.
...
ok drahn@
2013-09-23 15:39:53 -04:00
Dave Collins
62e38e29e5
Add a new function named SupportedDBs.
...
This function allows the callers to programatically ascertain which
database backend drivers are registered and therefore supported.
2013-09-15 15:18:46 -05:00
Dave Collins
a2946ea14b
Don't add "btcd.ldb" directory to provided path.
2013-09-13 17:32:04 -05:00
Dale Rahn
1530141ba0
This query should be performed as part of the transaction, not outside it.
2013-09-13 11:52:07 -04:00
Dale Rahn
9e27c82a23
Fix error messages (pointed out by go vet)
2013-09-13 11:49:30 -04:00
Dale Rahn
5e4c78a1b7
Fix a shadowed return parameter.
2013-09-13 10:54:45 -04:00
Dale Rahn
7d679a6228
Adjust Block height indicators properly when database is created.
2013-09-10 14:17:24 -04:00
Dave Collins
9049bcacec
Update error message for zero hash change.
2013-09-10 10:47:49 -05:00
Dave Collins
d9404fe880
Correct test for zero hash versus nil on empty db.
2013-09-10 10:45:02 -05:00
Dale Rahn
adc73cbc9d
quiet.
2013-09-10 11:25:13 -04:00
Dave Collins
85553133ce
gofmt.
2013-09-10 10:09:44 -05:00
Dave Collins
30f2003301
Remove spurious log.Info prints.
2013-09-10 10:09:43 -05:00
Dave Collins
66d6f10d5d
Fix NewestSha.
2013-09-10 10:09:42 -05:00