-
Notifications
You must be signed in to change notification settings - Fork 33
[Testing] Organizing test utilities package(s) #609
Copy link
Copy link
Labels
code healthNice to have code improvementNice to have code improvementtestingDefining, adding, automating or modifying testsDefining, adding, automating or modifying tests
Milestone
Description
Objective
Agree on a convention which we can document that establishes where to put common test code for reuse between packages.
Origin Document
Goals
- Agree on a conventional place to organize test utilities packages (e.g.
pocket/internal/testing) - Support de-duplication of test code across packages (i.e. test util pkgs are importable )
- Ensure test packages are excluded from non-test builds (e.g. using build constraints:
//go:build test)
Deliverable
- Document testing utils package location somewhere (contributing, development, wiki?)
- Add testing utils package; start by moving
prepareDNSResolverMock()frompocket/module_raintree_test.go(post [P2P] Refactor/consolidate P2P modules #576)
Non-goals / Non-deliverables
- Identifying additional duplication
- Refactoring unrelated test code
General issue deliverables
- Update the appropriate CHANGELOG(s)
- Update any relevant local/global README(s)
- Update relevant source code tree explanations
- Add or update any relevant or supporting mermaid diagrams
Testing Methodology
-
Ensure test util package members are not present in symbol table of non-test builds:
go build -o ./pokt-node ./app/pocketnm ./pokt-node | grep prepareDNSResolverMockshould print nothing
IfprepareDNSResolverMockwas included in the build, it will be listed in the symbol table which we can print withnm. Double-check the function names match, a typo could result in a false positive. Additionally, one can build a test binary (go test -c -o <output bin path> [-run <test func name>] <pkg>) on a test/pig which is known to import a test util function and ensure that it is present in the symbol table, as a control.
-
All tests:
make test_all -
LocalNet: verify a
LocalNetis still functioning correctly by following the instructions at docs/development/README.md
Creator: @bryanchriswhite
Co-Owners: @deblasis
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
code healthNice to have code improvementNice to have code improvementtestingDefining, adding, automating or modifying testsDefining, adding, automating or modifying tests
Type
Projects
Status
Done
