-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Testing] Organizing test utilities package(s) #609
Comments
@bryanchriswhite Just wanted to follow up with some additional context
|
f@Olshansk Haha - yea, I must have gotten distracted. Thanks for calling this out! 🙌 Sentence finished. ✔️ 😉 Thanks for the links! 🙌 I read through to golang-standards/project-layout which (great resource - thanks @Gustavobelfort) describes
I would argue that given the convention, would better communicate our intention to put cross-package test code in an EDIT: After mulling it over a bit more, I realize that UPDATE: There's a detail that the project-layout
(e.g.: in @Olshansk it would seem that to achieve the goal, we have no choice but to create a |
It also looks like build tags/constraints have changed since the last time I looked:
...
|
…685) ## Description Factors out some common `mockdns` usage, including a "noop" logger to things down (`mockdns` is noisy IMO). ## Issue Fixes #609 ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [ ] Bug fix - [x] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Create `/internal` directory - Add `/interal/testutil` pkg - Refactor existing `mockdns` usage ## Testing - [x] Ensure test util package members are not present in symbol table of non-test builds: 1. `go build -o ./pokt-node ./app/pocket` 2. `nm ./pokt-node | grep prepareDNSResolverMock` should print nothing If `prepareDNSResolverMock` was included in the build, it will be listed in the symbol table which we can print with `nm`. **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.  - [ ] `make develop_test`; if any code changes were made - [ ] [Docker Compose LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md); if any major functionality was changed or introduced - [ ] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made ## Required Checklist - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added, or updated, [`godoc` format comments](https://go.dev/blog/godoc) on touched members (see: [tip.golang.org/doc/comment](https://tip.golang.org/doc/comment)) - [ ] I have tested my changes using the available tooling - [ ] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [ ] I have updated the corresponding README(s); local and/or global - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added, or updated, [mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding README(s) - [ ] I have added, or updated, documentation and [mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*` if I updated `shared/*`README(s)
@bryanchriswhite Should this ticket be in the |
…de (#696) ## Description Factors out some common mockdns usage, including a "noop" logger to things down (mockdns is noisy IMO). (Duplicate of #685 🙄, I forgot to change the base branch before merging. As a result, the changes were squashed-merged into a different branch than main. Re-opening here, apologies for the extra noise. 🙏🙏) ## Issue Fixes #609 ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [ ] Bug fix - [x] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Create `/internal` directory - Add `/interal/testutil` pkg - Refactor existing `mockdns` usage ## Testing - [x] Ensure test util package members are not present in symbol table of non-test builds: 1. `go build -o ./pokt-node ./app/pocket` 2. `nm ./pokt-node | grep prepareDNSResolverMock` should print nothing If `prepareDNSResolverMock` was included in the build, it will be listed in the symbol table which we can print with `nm`. **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 pkg which is known to import a test util function and ensure that it is present in the symbol table, as a control.  - [ ] `make develop_test`; if any code changes were made - [ ] [Docker Compose LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md); if any major functionality was changed or introduced - [ ] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made ## Required Checklist - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added, or updated, [`godoc` format comments](https://go.dev/blog/godoc) on touched members (see: [tip.golang.org/doc/comment](https://tip.golang.org/doc/comment)) - [ ] I have tested my changes using the available tooling - [ ] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [ ] I have updated the corresponding README(s); local and/or global - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added, or updated, [mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding README(s) - [ ] I have added, or updated, documentation and [mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*` if I updated `shared/*`README(s)
Objective
Agree on a convention which we can document that establishes where to put common test code for reuse between packages.
Origin Document
Goals
pocket/internal/testing
)//go:build test
)Deliverable
prepareDNSResolverMock()
frompocket/module_raintree_test.go
(post [P2P] Refactor/consolidate P2P modules #576)Non-goals / Non-deliverables
General issue deliverables
Testing Methodology
Ensure test util package members are not present in symbol table of non-test builds:
go build -o ./pokt-node ./app/pocket
nm ./pokt-node | grep prepareDNSResolverMock
should print nothingIf
prepareDNSResolverMock
was 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
LocalNet
is still functioning correctly by following the instructions at docs/development/README.mdCreator: @bryanchriswhite
Co-Owners: @deblasis
The text was updated successfully, but these errors were encountered: