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

test: Add json marshal/unmarshal for test traces #1314

Merged
merged 32 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d8dcf54
Add json marshal/unmarshal for test traces
p-offtermatt Sep 19, 2023
276e347
Remove auto-generated trace files
p-offtermatt Sep 19, 2023
28eec48
Add an example trace to see the input format
p-offtermatt Sep 19, 2023
ae67d35
Add comment in rapid test
p-offtermatt Sep 19, 2023
5d894e6
Remove duplicated test case
p-offtermatt Sep 19, 2023
5dfb63b
Remove TODO in favor of comment
p-offtermatt Sep 19, 2023
0948b05
Reduce code duplication
p-offtermatt Sep 19, 2023
e3e3e84
Run go mod tidy and make format
p-offtermatt Sep 19, 2023
010bec3
Correct testdata directory in gitignore
p-offtermatt Sep 19, 2023
f00e209
Remove testdata directory
p-offtermatt Sep 19, 2023
70350c2
Remove testdata from gitignore
p-offtermatt Sep 19, 2023
b02d4f7
Add tracehandler_testdata
p-offtermatt Sep 19, 2023
a519315
Remove example trace, since there are examples in the test data
p-offtermatt Sep 19, 2023
9eb0a1f
Revert unintentional change to .gitignore
p-offtermatt Sep 20, 2023
2f961cf
Remove propType field from generator
p-offtermatt Sep 20, 2023
760c67a
Add docstrings to action_rapid test and state_rapid_test to better ex…
p-offtermatt Sep 20, 2023
dcd49a4
bite -> byte
p-offtermatt Sep 20, 2023
b04adb3
Refactor: slashThrottleDequeue to slashThrottleDequeueAction
p-offtermatt Sep 20, 2023
4b4c76d
action name -> action type
p-offtermatt Sep 20, 2023
d146505
use method name as first word in docstring
p-offtermatt Sep 20, 2023
7209628
Simply remove simply
p-offtermatt Sep 20, 2023
b4e35e3
Clarify that WriteTrace overrides
p-offtermatt Sep 20, 2023
55d2686
Remove outdated comments
p-offtermatt Sep 20, 2023
5841fce
Add RegisteredConsumerRewardDenoms to rapid test
p-offtermatt Sep 20, 2023
1168aca
Add gen for submitChangeRewardDenomsProposalAction
p-offtermatt Sep 20, 2023
72729a8
Remove startChain steps
p-offtermatt Sep 20, 2023
9016327
Marshal step files with indent
p-offtermatt Sep 20, 2023
e837330
Add README that contains info about updates to trace format
p-offtermatt Sep 20, 2023
05232d9
Pull out the copied ChainState and Proposal types from methods
p-offtermatt Sep 21, 2023
f8c8329
Use shadowing to avoid relisting chainstate fields
p-offtermatt Sep 21, 2023
c77484e
Make format
p-offtermatt Sep 21, 2023
ccdd117
Remove log
p-offtermatt Sep 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ require (
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
github.com/creachadair/taskgroup v0.4.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
Expand All @@ -88,7 +88,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.5.9
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
Expand Down Expand Up @@ -161,7 +161,7 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v0.5.5 // indirect
pgregory.net/rapid v0.5.5
sigs.k8s.io/yaml v1.3.0 // indirect
)

Expand Down
13 changes: 13 additions & 0 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Updating the trace format and tests when adjusting the framework

Some things in the test framework should stay consistent, in particular with respect to the trace format.
When adding or modifying actions, please follow these guidelines:
* Add a case for your action to `main.go`
* Add a case for your action to `json_utils.go/UnmarshalMapToActionType`
* Add a generator for your action to `action_rapid_test.go` and add the generator to `GetActionGen`

If the chain state from `state.go` is modified, the `ChainStateWithProposalTypes` in `json_utils.go/MarshalJSON` should be updated.

When adding a new proposal type:
* add a case for your proposal type to `json_utils.go/UnmarshalProposalWithType`
* add a generator for your proposal type in `state_rapid_test.go` and add it to the `GetProposalGen` function
Loading
Loading