Skip to content

[Testing (DUP)] Add /internal/testutil pkg & refactor mockdns test code#696

Merged
bryanchriswhite merged 4 commits intomainfrom
test/testutils
Apr 21, 2023
Merged

[Testing (DUP)] Add /internal/testutil pkg & refactor mockdns test code#696
bryanchriswhite merged 4 commits intomainfrom
test/testutils

Conversation

@bryanchriswhite
Copy link
Collaborator

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
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Create /internal directory
  • Add /interal/testutil pkg
  • Refactor existing mockdns usage

Testing

  • 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.

image

  • make develop_test; if any code changes were made
  • Docker Compose LocalNet; if any major functionality was changed or introduced
  • k8s LocalNet; 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 on touched members (see: 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 diagrams in the corresponding README(s)
  • I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

@bryanchriswhite bryanchriswhite merged commit 9a6cff7 into main Apr 21, 2023
@bryanchriswhite bryanchriswhite deleted the test/testutils branch April 21, 2023 06:27
bryanchriswhite added a commit that referenced this pull request Apr 24, 2023
* pokt/main:
  Update devlog6.md
  [CLI] Remove logging for end user focused messages (#698)
  [Testing (DUP)] Add /internal/testutil pkg & refactor mockdns test code (#696)
  [Infra] Adapt pocket helm chart for DevNets (#682)
  Update changelog-verify.yml (#691)
bryanchriswhite added a commit that referenced this pull request Apr 25, 2023
* pokt/main:
  [E2E] adds in-cluster config for E2E tests (#689)
  [Makefile] fixes the localnet_db_cli target (#700)
  Update devlog6.md
  [CLI] Remove logging for end user focused messages (#698)
  [Testing (DUP)] Add /internal/testutil pkg & refactor mockdns test code (#696)
  [Infra] Adapt pocket helm chart for DevNets (#682)
  Update changelog-verify.yml (#691)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Testing] Organizing test utilities package(s)

2 participants