dcrd
dcrd copied to clipboard
integration: refactor regression test framework
All Submissions:
- [ ] Submission follows the Code Contribution Guidelines
- [x] There are not any other open Pull Requests for the same update/change
- [ ] Commit messages are formatted according to Model Git Commit Messages
- [x] All changes are compliant with the latest version of Go and the one prior to it
- [ ] The code being submitted is commented according to the Code Documentation and Commenting section of the Code Contribution Guidelines
- [ ] Any new logging statements use an appropriate subsystem and logging level
- [x] Code has been formatted with go fmt
- [x] Running go test does not fail any tests or report any vet issues
- [ ] Running golint does not report any new issues that did not already exist
New Feature Submissions:
- [x] Code is accompanied by tests which exercise both the positive and negative (error paths) conditions (if applicable)
Bug Fixes:
- [x] Code is accompanied by new tests which trigger the bug being fixed to prevent regressions
Changes to Core Features:
- [x] An explanation of what the changes do and why they should be included is provided
- [x] Code is accompanied by updates to tests and/or new tests for the core changes (if applicable)
The purpose of the PR is to implement regression testing framework for dcrd
and dcrwallet
.
Proposed changes:
-
Refactored package:
integration/
Provides registry to ensure proper tracking and disposal of leaky assets. Provides helpers for the test setup to detect its own defects. Offers temporary directories management. Offers management for reusable resources (e.g harnesses). Test files were moved tointegration/harness/simpleregtest/
-
Edit: package
main
rpcserver_test.go
was moved tointegration/harness/simpleregtest/
-
Added package:
integration/commandline/
Provides helpers to run external command-line tools, e.ggo
code builder,dcrd
anddcrwallet
executables. Ensures proper disposal of the external processes to avoid CPU leaks. Seeexample_test.go
for the usage. -
Added package:
integration/gobuilder/
Helps to build a target Go project upon request. -
integration/rpctest/
-package was completely demolished. Tests were split into separated files and moved tointegration/harness/simpleregtest/
Harnesses and test setup code was refactored and moved tointegration/harness
-
Added package:
integration/harness/
Provides reusable modules allowing to assemble and to configure any desired test environment. Defines test harness and it's sub-components. -
Added package:
integration/harness/memwallet/
Offers a simple in-memory wallet whose purpose is to provide basic test wallet functionality to the harness. -
Added package:
integration/harness/testnode/
Offers a default test node that launches a newdcrd
-instance using command-line call. -
Added package:
integration/harness/simpleregtest/
Harbors original tests from therpctest
-package and offers test setup to run these tests.
Tests:
@davecgh All tests passed. You can start browsing the code.
I;ll look into it later.
I did re-base. It seems to be working.
@dajohi I need some guidance on how to reproduce your comments above.
FYI: The next version of this PR is released here (as a separated repo): https://github.com/JFixby/dcrregtest
This is no longer relevant since rpctest
has been split into its own dcrtest repo.