Conversation
* creates the e2e/tests directory for godog tests * adds a simple root command feature * adds ErrPending step definitions generated from the feature definition * adds a make target for running the e2e tests * adds godog to deps
- adds rough idea of what building docker test containers could look like - adds a simple network config interpretation that runs cucumber tests - explores the Network struct implementation to manage docker container nodes - explores the idea of multiple network configs being accepted at test time for multiple seed network configs being tested. seeds it with a default value in the meantime while we figure out what configs network needs at start time.
* cleaning up and prepping code for docker-compose management * stubs out failing network creation method * tests are failing as expected
- starts a client container assuming that a compose_and_watch local network is running - assigns that role to commander in the init steps - current problem is that container is not started when we try to run commands against it, so I think we need to ensure proper waiting and proper cleanup of the container.
- wires up a simple proof of concept that has a container being fed commands by a Gherkin Given/When/Then setup. - needs clean up and documentation.
| go test -p 1 -count=1 ./... | ||
|
|
||
| .PHONY: test_e2e | ||
| test_e2e: ## Assumes that `localnet_up` is running *warm*. |
There was a problem hiding this comment.
-
Try running
makefrom the root of the repo. The comment is actually thehelpcommand and not just a makefile comment. -
Optional NIT: Is there a way to add a small check to validate that it's up and running? Potentially another target making a small RPC call? See
docker_checkas an example
| func (k *KubeClient) RunCommand(args ...string) (*CommandResult, error) { | ||
| base := []string{"exec", "-it", "deploy/pocket-v1-cli-client", "--container", "pocket", "--", "client"} | ||
| args = append(base, args...) | ||
| cmd := exec.Command("kubectl", args...) |
There was a problem hiding this comment.
Why are we ignoring the error?
There was a problem hiding this comment.
Which error do you mean here?
There was a problem hiding this comment.
The way I've seen this used in the past is:
cmd := exec.Command("prog")
if errors.Is(cmd.Err, exec.ErrDot) {
cmd.Err = nil
}
if err := cmd.Run(); err != nil {
log.Fatal(err)
}Source: https://pkg.go.dev/os/exec
Is that something we want to do or is cmd.Output capturing it?
## Description Help us bootstrap and subsequently maintain `godoc` comments in the codebase via our existing review process. ## Issue  ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [ ] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [x] Other: Tooling ## List of changes - Adds an item to the "Required Checklist" in the PR template ## Next Steps I'm extremely confident that we could automate these checks with the correct linter / config. At that point, we could remove this checklist item. ## Testing - [ ] `make develop_test` - [ ] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` ## Required Checklist - [x] 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)
I really hope Olshansky doesn't see this commit
## Description Due to circumstances and timing, @Olshansk's final review on #540 came in after merging. This PR implements improvements based on that review feedback. ## Issue Related to #347 ## 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 - Correct libp2p module tests - Improve libp2p code quality in response to post-merge review feedback ## Testing - [ ] `make develop_test` - [ ] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` ## Required Checklist - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] 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)
…LI commands (#561) ## Description Adds a `MessageRoutingType` field for distinguishing debug message [routing types](https://en.wikipedia.org/wiki/Routing) in the debug CLI. ## Issue Fixes #344 ## 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 - Adds a RoutingType field to the DebugMessage - Distinguishes the routing types of each message in the Debug CLI ## Testing - [x] `make develop_test` - [x] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` ## Required Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have tested my changes using the available tooling - [x] 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)
## Description <!-- REMOVE this comment block after following the instructions 1. Add a summary of the change including: motivation, reasons, context, dependencies, etc... 2. If applicable, specify the key files that should be looked at. --> `make localnet_client_debug` currently fails on machines with low~ish amount of RAM. Key import loads 999 validator keys quickly, but cryptographic calculations are so intense on memory it only imports 250 keys before dying OOM on my 16Gi virtual machine. ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [x] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes <!-- REMOVE this comment block after following the instructions List out all the changes made --> - Wrapped key import part into concurrency limiter (https://github.com/korovkin/limiter) ## Testing - [x] `make develop_test` - [x] `make localnet_client_debug` - [x] `make client_start && make client_connect` <!-- REMOVE this comment block after following the instructions If you added additional tests or infrastructure, describe it here. Bonus points for images and videos or gifs. --> ## Required Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have tested my changes using the available tooling - [x] 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) --------- Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
…#596) ## Description This PR improves DevX by outputting the result of a changelog validation into the PR and requesting changes:  Once the check is successful, the automatically added review comments are dismissed The commits of this PR are also included in #577 ## Issue None because developed in < 4h ## Type of change Please mark the relevant option(s): - [x] New feature, functionality or library - [ ] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Updated changelog-verify.yaml to automatically review / dismiss changelog specific reviews ## Testing - [ ] `make develop_test` - [ ] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` ## 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) --------- Signed-off-by: Alessandro De Blasis <alex@deblasis.net>
## @Reviewer This PR may be more digestible / reviewable on a commit-by-commit basis. Commits are organized logically and any given line is only modified in a single commit, with few exceptions. --- ## Description Redifines P2P module packages in terms of new interfaces: - `Peer` / `PeerList` - `Peerstore` - `PeerManager` / `PeersView` This has the effect of decoupling the `Network` implementation (e.g. `rainTreeNetwork`) from the peer representation and storage/lookup. This will be necessary for use with the libp2p based P2P module as it uses different implementations for these concerns. ### Organization This PR adds a *temporary* `shared/p2p` package to facilitate the migration to the new libp2p based P2P module implementation. This package will be re-consolidated into the remaining P2P module as part of #554. ``` ├── p2p │ └── * addrbook_delta_test.go -> peer_test.go └── shared └── p2p ├── + peer.go ├── + peer_manager.go └── + peerstore.go ``` #### peer.go - `Peer` interface - abstracted from [`typesP2P.NetworkPeer`](https://github.com/pokt-network/pocket/blob/main/p2p/types/network_peer.go#L7) and its usage - `PeerList` concrete type (`[]Peer`) - implements a `#Delta()` method - ported from [`GetAddrBookDelta`](https://github.com/pokt-network/pocket/blob/main/p2p/addrbook_delta.go#L6) #### peerstore.go - `Peerstore` interface plus a simple map-based implementation, `PeerAddrMap` #### peer_manager.go - `PeerManager` and `PeerView` interfaces - abstracted from [`raintree.peersManager`](https://github.com/pokt-network/pocket/blob/main/p2p/raintree/peers_manager.go#L15) and its usage - `SortedPeerManager` implementation factored out of the same, `raintree.peersManager` - decouples sorting and "view construction" ([`networkView`](https://github.com/pokt-network/pocket/blob/main/p2p/raintree/peers_manager.go#L181)) behavior from any conception of raintree specific network features (e.g. "levels") ### Nomenclature changes `AddrBook` --> `Peerstore`: The word "address" is becoming ambiguous as libp2p nomenclature uses it to refer to the network address (e.g. IP / hostname). As it's currently used, this object holds more than just the both identity and network address so regardless of interpretation, I would argue that `AddrBook` doesn't accurately convey its responsibility. `Peerstore` also better aligns with other libp2p nomenclature and should result it in more consistent and coherent integration and refactoring going forward. ### Potential next steps 1. Decouple peer connection management from identity/address storage and lookup. - Add a `ConnManager` interface to be responsible for this - Move `Peer#GetStream()` to it - Move `PeerManager#GetSelfAddr()` to it - Refactor accordingly ## Issue Fixes #552 ## 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 - Add `Peer` and `Peerstore` interfaces - Refactor `AddrBook` to `PeerList` type - Refactor `getAddrBookDelta` to be a member of `PeerList` - Move `typesP2P.AddrBookMap` to `sharedP2P.PeerAddrMap` and refactor to implement the new `Peerstore` interface - Factor `SortedPeerManager` out of `raintree.peersManager` and add `peerManager` interface - Refactor `raintree.peersManager` to use `SortedPeerManager` and implement `PeerManager` interface - Refactor `stdnetwork.Network` implementation to use P2P interfaces - Refactor `AddrBookProvider` to use new P2P interfaces - Refactor `typesP2P.Network` to use new P2P interfaces - Refactor `typesP2P.Transport` to embed `io.ReadWriteCloser` - Rename `NetworkPeer#Dialer` to `NetworkPeer#Transport`for readability and consistency - Refactor `typesP2P.NetworkPeer` to implement the new `Peer` interface - Refactor debug CLI to use new P2P interfaces ## Testing - [x] `make develop_test` - [x] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` <!-- REMOVE this comment block after following the instructions If you added additional tests or infrastructure, describe it here. Bonus points for images and videos or gifs. --> ## Required Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have tested my changes using the available tooling - [x] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [ ] I have updated the corresponding README(s); local and/or global - [x] 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)
## Description A helper logger function implementation for logging convenience of StateMachineTransitionEvents. ## Issue Fixes #571 ## 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 - Add `EventToMap()` helper function for logging - Log `StateMachineTransitionEvent` in P2P ## Testing - [X] `make develop_test` - [X] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` ## Required Checklist - [X] I have performed a self-review of my own code - [X] I have commented my code, particularly in hard-to-understand areas - [X] I have tested my changes using the available tooling - [X] 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) --------- Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
…mServiceURL function (#597) ## Description Improve URL validation and error handling in Libp2pMultiaddrFromServiceURL function This PR updates the Libp2pMultiaddrFromServiceURL function to reject URLs with a scheme, ensure that URLs contain a port number, and validate the port number as a valid integer. It also improves error messages and updates test cases in url_conversion_test.go to match the updated error messages and use square brackets for IPv6 addresses. Additionally, a test case for missing port number and delimiter in the URL has been added, along with examples for the Libp2pMultiaddrFromServiceURL function usage. Previously, a test case would behave differently on a server configured with a search domain or search list. This attempts to iron out those inconsistencies by validating the service URL. ## Issue Fixes #584 ## Type of change Please mark the relevant option(s): - [ ] New feature, functionality or library - [x] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes ## Changelog - Updated `testIP6ServiceURL` constant to enclose the IPv6 address in square brackets in `network_test.go`. - Modified `Libp2pMultiaddrFromServiceURL` function in `url_conversion.go` to: - Reject URLs with a scheme. - Ensure that URLs contain a port number. - Validate the port number as a valid integer. - Improve error messages. - Updated test cases in `url_conversion_test.go` to: - Use square brackets for IPv6 addresses. - Adjust expected error messages to match the updated error messages in `Libp2pMultiaddrFromServiceURL`. - Add test case for missing port number and delimiter in the URL. - Added examples for `Libp2pMultiaddrFromServiceURL` function usage in `url_conversion_test.go`. ## Testing - [x] `make develop_test` - [ ] [LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md) w/ all of the steps outlined in the `README` ## Required Checklist - [x] 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) --------- Co-authored-by: Bryan White <bryanchriswhite@gmail.com>
- adds rough idea of what building docker test containers could look like - adds a simple network config interpretation that runs cucumber tests - explores the Network struct implementation to manage docker container nodes - explores the idea of multiple network configs being accepted at test time for multiple seed network configs being tested. seeds it with a default value in the meantime while we figure out what configs network needs at start time.
- starts a client container assuming that a compose_and_watch local network is running - assigns that role to commander in the init steps - current problem is that container is not started when we try to run commands against it, so I think we need to ensure proper waiting and proper cleanup of the container.
|
@dylanlott I know you've added a lot of new code, so please resolve the comments that you've tended to and re-request a review once ready. Maybe @okdas should review as well? |
|
Closing, addressed by #644. |
## Description This PR introduces the E2E test harness and tests for Stake, Unstake, and Send commands. - The E2E test suite is run with the command `make test_e2e` which calls `go test` with the proper flags and arguments to run the Cucumber E2E tests. - The E2E tests work by loading a local Kubeconfig and connecting to the local cluster then issuing commands to a validator's `client` binary with the cluster's `kubectl exec`. This means that the test runner must have a LocalNet up and running with a properly configured Kubeconfig at the default `$HOME/.kube/config` path. - The tests stake validator001's address with 150000000001 POKT and then unstakes it and asserts no error was reported from either command. - After that, the tests send a balance of 150000000 POKT to validator002 and asserts no error was reported. ## Issue Fixes #466 Closes #589 (this PR achieves the same but adds more test cases) ## Type of change Please mark the relevant option(s): - [x] New feature, functionality or library - [ ] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [x] Documentation ## List of changes - Adds the `e2e/tests` directory - Adds `godog` dependency for running tests. - Sets up the E2E test harness to build when `-tags=e2e` is provided. - Creates a Make target `test_e2e` that runs the E2E tests. - Defines the `PocketClient` single-function interface for interacting with a built binary. - Makes the Send command respect non_interactive flags when parsing passwords. - Adds a README and CHANGELOG for the `e2e` directory that contains documentation about how to use, develop with, and run the E2E tests. ## Testing - [x] `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 - [x] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made [Staking & Unstaking test demo 🎥](https://drive.google.com/file/d/1G63R85oWw5R5jT7pqlNG_vheEz3fVKcB/view?usp=share_link) ## Required Checklist - [x] I have performed a self-review of my own code - [x] 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)) - [x] I have tested my changes using the available tooling - [x] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [x] I have updated the corresponding README(s); local and/or global - [x] I have added tests that prove my fix is effective or that my feature works - [x] 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) --------- Co-authored-by: Dmitry Knyazev <okdas@users.noreply.github.com> Co-authored-by: Daniel Olshansky <olshansky@pokt.network>
Description
This PR adds the E2E test harness with an example of how it can drive around a KubeClient to test commands in a Pod against the built binary. It also adds a button to the Tilt UI that manually triggers the E2E test suite to run for development purposes.
Issue
FIxes #580 as part of a set of changes addressed by #466
Type of change
Please mark the relevant option(s):
List of changes
Testing
make develop_testREADMERequired Checklist
If Applicable Checklist
shared/docs/*if I updatedshared/*README(s)