Skip to content
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

SetupConfig function for Unit Tests #519

Merged
merged 1 commit into from
Dec 19, 2022
Merged

Conversation

sampocs
Copy link
Collaborator

@sampocs sampocs commented Dec 15, 2022

Closes: #XXX

Context and purpose of the change

When working with addresses in unit tests, we need to update the sdk config to have a stride address prefix. The function to set these config settings was already in our test utils, but it was limited to our keeper test framework. This PR makes the setup function public so it can be leveraged by non-keeper tests.

Brief Changelog

  • Moved config settings out of init and into a SetupConfig function
  • Added config function to apptesting so it's easily importable
  • Added function to generate test addresses

Usage

import "github.com/Stride-Labs/stride/v4/app/apptesting"

apptesting.SetupConfig()
validAddr, invalidAddr := apptesting.GenerateTestAddrs()

Author's Checklist

I have...

  • Run and PASSED locally all GAIA integration tests
  • If the change is contentful, I either:
    • Added a new unit test OR
    • Added test cases to existing unit tests
  • OR this change is a trivial rework / code cleanup without any test coverage

If skipped any of the tests above, explain.

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • reviewed state machine logic
  • reviewed API design and naming
  • manually tested (if applicable)
  • confirmed the author wrote unit tests for new logic
  • reviewed documentation exists and is accurate

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes?
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md?
  • This pull request updates existing proto field values (and require a backend and frontend migration)?
  • Does this pull request change existing proto field names (and require a frontend migration)?
    How is the feature or change documented?
    • not applicable
    • jira ticket XXX
    • specification (x/<module>/spec/)
    • README.md
    • not documented

@sampocs sampocs marked this pull request as ready for review December 15, 2022 23:22
@sampocs sampocs mentioned this pull request Dec 15, 2022
19 tasks
@sampocs sampocs force-pushed the address-setup-for-types-tests branch from bc8ab32 to 9eea31a Compare December 19, 2022 17:30
@sampocs sampocs added the A:automerge Automatically merge PR once checks pass label Dec 19, 2022
@mergify mergify bot merged commit 4996b7b into main Dec 19, 2022
sontrinh16 pushed a commit to notional-labs/stride that referenced this pull request Mar 27, 2023
Closes: #XXX

## Context and purpose of the change
When working with addresses in unit tests, we need to update the sdk config to have a stride address prefix. The function to set these config settings was already in our test utils, but it was limited to our keeper test framework. This PR makes the setup function public so it can be leveraged by non-keeper tests.

## Brief Changelog
* Moved config settings out of `init` and into a `SetupConfig` function
* Added config function to apptesting so it's easily importable
* Added function to generate test addresses

## Usage
```go
import "github.com/Stride-Labs/stride/v4/app/apptesting"

apptesting.SetupConfig()
validAddr, invalidAddr := apptesting.GenerateTestAddrs()
```

## Author's Checklist

I have...

- [ ] Run and PASSED locally all GAIA integration tests
- [ ] If the change is contentful, I either:
    - [ ] Added a new unit test OR 
    - [ ] Added test cases to existing unit tests
- [ ] OR this change is a trivial rework / code cleanup without any test coverage

If skipped any of the tests above, explain.


## Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] manually tested (if applicable)
- [ ] confirmed the author wrote unit tests for new logic
- [ ] reviewed documentation exists and is accurate


## Documentation and Release Note

  - [ ] Does this pull request introduce a new feature or user-facing behavior changes? 
  - [ ] Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`?
  - [ ] This pull request updates existing proto field values (and require a backend and frontend migration)? 
  - [ ] Does this pull request change existing proto field names (and require a frontend migration)?
  How is the feature or change documented? 
      - [ ] not applicable
      - [ ] jira ticket `XXX` 
      - [ ] specification (`x/<module>/spec/`) 
      - [ ] README.md 
      - [ ] not documented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once checks pass C:app-wiring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants