Commit Graph

423 Commits

Author SHA1 Message Date
ghubstan
65e3370d51
Add license note, format tearDown(), fix comment 2020-07-12 22:03:46 -03:00
ghubstan
db5a685468
Make init() method public 2020-07-12 21:56:51 -03:00
ghubstan
81aeeddc4a
Add MethodTestSuite 2020-07-12 21:52:23 -03:00
ghubstan
0edcc3baa8
Add first method test cases
These are method test cases for gRPC methods that have already been
well tested by :cli/test.sh
2020-07-12 21:48:22 -03:00
ghubstan
96cabfb177
Support @Skip on test classes and methods
Add super class for all test types (method, scenario, end-to-end),
and an class & method level annotation for skipping tests.
2020-07-12 21:44:21 -03:00
ghubstan
390cba1b75
Fix codacy problem
Codacy wants comments inside an empty method.
2020-07-12 14:53:32 -03:00
ghubstan
ffe376e8dc
Fix codacy problems
Avoid throwing raw exception types.

Document empty method body.
2020-07-12 14:39:20 -03:00
ghubstan
2c10836a69
Expose grpc service stubs
Added :proto to the :apitest classpath for access to grpc
service stubs (to be) used in method (unit) tests.  Added new
GrpcStubs class to expose the grpc service stubs to method and
scenario tests.

The larger goal of :apitest is end to end testing, where :cli's
console output is checked for correctness.

This change partially addresses two other important use cases:

 * "method" testing -- an analog to unit testing
 * "scenario" testing -- an analog to narrow functional testing

For example, tests in the apitest.method package will directly
call grpc services, and asserts will be made on the return values
instead of console output.

Tests in the apitest.scenario package will check correctness
for broader use cases, such as funding a wallet, encrypting then
unlocking a wallet  for a specific time frame, or checking error
messages from the server when a "getbalance" call is made after
an "unlockwallet" timeout has expired.

The broader end to end tests will not use grpc stubs.
2020-07-12 13:55:08 -03:00
ghubstan
87525ca85d
Move test setup scaffolding into new Scaffold class
ApiTestMain will run all defined tests, but we also want to run
individual test suites and test cases, and they will need to
run the setup tasks as well.
2020-07-12 13:36:10 -03:00
ghubstan
851902117d
Add line break in front of port config 2020-07-12 13:23:53 -03:00
ghubstan
a1e2536ed5
Fix hanging background process problem
SetupTask submissions for Bisq background apps seednode, arbnode,
etc., would not always complete due to a blocking stderr stream
handler thread.join() call.  This change makes waiting on a bash
process err stream optional.
2020-07-11 18:15:17 -03:00
ghubstan
898219aba5
Assume bitcoin-core is statically linked to berkeley-db
The `berkeleyDbLibPath` option now defaults to an empty string.
If not set to a berkeley lib path on the command line or the
apitest.properties file, this option is ignored, and 'bitcoind'
will be started without first exporting the berkeley db library
path.

In other words:  If the bitcoind binary is dynamically linked to
berkeley db libs, export the configured berkeley-db lib path before
starting 'bitcoind'.  If statically linked,  the berkeley db lib
path will not be exported.

Also fixed exception msgs to show missing config file's absolute path.
2020-07-11 10:26:26 -03:00
ghubstan
798fde847b
Fix error msgs 2020-07-10 14:27:25 -03:00
ghubstan
ca378cdd13
Fix error msg spacing 2020-07-10 14:24:35 -03:00
ghubstan
05d0ce0ef8
Fix codacy problem
Avoid throwing null pointer exceptions.
2020-07-09 16:56:09 -03:00
ghubstan
efbaa5be73
Fix codacy problems
Avoid throwing raw exception types.

Combine nested if statements.
2020-07-09 16:54:03 -03:00
ghubstan
09929c833f
Fix codacy problems
Unnecessary use of fully qualified name 'System.exit' due to existing
static import 'java.lang.System.exit'.  (line 100)

Avoid throwing raw exception types.  (lines 295, 302)
2020-07-09 16:49:16 -03:00
ghubstan
e9baebc443
Add build tasks for installing dao-setup files
This gradle file is 'applied' by the main build file.

Usage:

  Run a full clean, build, download dao-setup.zip,
  and install the zip files contents in directory
  apitest/build/resources/main:

    ./gradlew clean build :apitest:installDaoSetup

  Download (if necessary) the dao-setup.zip file
  and install its contents in directory
  apitest/build/resources/main  (no build).

    ./gradlew :apitest:installDaoSetup
2020-07-09 16:03:46 -03:00
ghubstan
ae3b263cac
Add :apitest main driver, setup task & dummy tests
The driver class uses an ExecutorService to submit Callable
tasks for starting bitcoind and Bisq nodes as Linux background
processes.

By default, ApiTestMain starts background processes to support
regtest/dao testing, runs a few bitcoin-cli commands, then
shuts down all background processes before exiting.
(Actual API test suites have not been implemented yet.)

ApiTestConfig options can be used to skip tests and/or leave
background processes running indefinitely.
2020-07-09 15:49:12 -03:00
ghubstan
c0c75e2471
Support starting bitcoin & bisq apps on Linux
The apitest.linux package is for running random bash commands,
running 'bitcoind -regtest', running random 'bitcoin-cli -regtest'
commands, and spinning up Bisq apps such as seednode, arbnode,
and bob & alice nodes.

All but random bash and bitcoin-cli commands are run in the background.

The bitcoin-cli response processing is crude;  a more sophiticated
bitcoin-core rpc interface is not in the scope of this PR.
2020-07-09 15:35:45 -03:00
ghubstan
77b6878ec6
Add script to get Bisq app pid
Finding the pid of background linux/java processes has been
difficult to do from java, so a bash script is provided to
simplify the task.
2020-07-09 15:30:22 -03:00
ghubstan
e0c27eedcf
Add main resource files
* apitest.properties - config file for customizing ApiTestConfig
  options

* logback.xml - logging config file, will override logback files
  found in classpath

* bitcoin.conf - bitcoin-core regtest config file, overwritten
  during startup with correct path to blocknofity

* blocknotify - bitcoin-core blocknotify config file
2020-07-09 15:27:01 -03:00
ghubstan
88b5e9dbad
Add configuration support
ApiTestConfig works like :common Config, but specific to this subproject.

BisqAppConfig is an enumeration specifying Bisq desktop and daemon
options for running seednode, arbnode, bob & alices nodes in regtest /
full-dao mode.
2020-07-09 15:11:42 -03:00