dcrd icon indicating copy to clipboard operation
dcrd copied to clipboard

integration: refactor regression test framework

Open JFixby opened this issue 6 years ago • 4 comments

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 to integration/harness/simpleregtest/

  • Edit: package main rpcserver_test.go was moved to integration/harness/simpleregtest/

  • Added package: integration/commandline/ Provides helpers to run external command-line tools, e.g go code builder, dcrd and dcrwallet executables. Ensures proper disposal of the external processes to avoid CPU leaks. See example_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 to integration/harness/simpleregtest/ Harnesses and test setup code was refactored and moved to integration/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 new dcrd-instance using command-line call.

  • Added package: integration/harness/simpleregtest/ Harbors original tests from the rpctest-package and offers test setup to run these tests.

Tests:

image

JFixby avatar Nov 11 '18 20:11 JFixby

@davecgh All tests passed. You can start browsing the code.

JFixby avatar Nov 12 '18 10:11 JFixby

I;ll look into it later.

JFixby avatar Feb 18 '19 11:02 JFixby

I did re-base. It seems to be working.

@dajohi I need some guidance on how to reproduce your comments above.

JFixby avatar Mar 08 '19 18:03 JFixby

FYI: The next version of this PR is released here (as a separated repo): https://github.com/JFixby/dcrregtest

JFixby avatar Jun 14 '19 20:06 JFixby

This is no longer relevant since rpctest has been split into its own dcrtest repo.

davecgh avatar Nov 17 '22 15:11 davecgh