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

New integration test method for gnoland #1101

Closed
moul opened this issue Sep 6, 2023 · 0 comments · Fixed by #1117
Closed

New integration test method for gnoland #1101

moul opened this issue Sep 6, 2023 · 0 comments · Fixed by #1117
Assignees

Comments

@moul
Copy link
Member

moul commented Sep 6, 2023

I propose adding a txtar driver in gno.land/cmd/gnoland/integration_test.go, akin to what's in gnovm/cmd/gno/* and Gnoffee (PR #1092).

This will let us launch an in-memory blockchain and use txtar for various gnokey commands.

It'll simulate account registrations, transactions, package additions, and interactions.

Related with #1016
Addresses #979
Related with #972

@moul moul moved this to 🌟 Wanted for Launch in 🚀 The Launch [DEPRECATED] Sep 6, 2023
@moul moul added this to the 🌟 main.gno.land (wanted) milestone Sep 8, 2023
@moul moul closed this as completed in #1117 Oct 5, 2023
moul added a commit that referenced this issue Oct 5, 2023
Resolves #1101.

This PR establishes a base for creating `txtar` tests using a partial
in-memory `gnoland` node. It supports:

- `gnoland [start|stop]`: The node doesn't start automatically, which
enables users to perform pre-configuration or pass custom arguments to
the start command.
- `gnokey`: Most of the commands should work. The `--remote`,
`--insecure-password-stdin`, and `--home` flags are automatically set
with the appropriate values to communicate with the node.
- `sleep`: A simple helper to introduce a delay between actions,
ensuring specific tasks complete before proceeding.

Currently, only the "test1" user is automatically created in the default
keybase directory (without a password). Default `gnoland` genesis
balance and genesis transaction files are also load on start.

You can find some examples of `txtar` in this directory:

https://github.com/gfanton/gno/tree/feat/gnoland-txtar-driver/gno.land/cmd/gnoland/testdata

`gnoland` logs aren't forwarded to stdout to avoid overwhelming
informations in the tests. Instead, you can specify a log directory
using the `LOG_DIR` environment variable or set `TESTWORK=true` to
enable persistence in the `txtar` working directory. In either case, the
path to the log file will be printed at the start if one of these
environment variables is set.
This also enables storing logs as artifacts on the CI for later
examination.

There is still a lot to do, but I believe this provides a good base for
future iterations.

<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
Co-authored-by: Morgan <git@howl.moe>
gfanton added a commit to gfanton/gno that referenced this issue Nov 9, 2023
Resolves gnolang#1101.

This PR establishes a base for creating `txtar` tests using a partial
in-memory `gnoland` node. It supports:

- `gnoland [start|stop]`: The node doesn't start automatically, which
enables users to perform pre-configuration or pass custom arguments to
the start command.
- `gnokey`: Most of the commands should work. The `--remote`,
`--insecure-password-stdin`, and `--home` flags are automatically set
with the appropriate values to communicate with the node.
- `sleep`: A simple helper to introduce a delay between actions,
ensuring specific tasks complete before proceeding.

Currently, only the "test1" user is automatically created in the default
keybase directory (without a password). Default `gnoland` genesis
balance and genesis transaction files are also load on start.

You can find some examples of `txtar` in this directory:

https://github.com/gfanton/gno/tree/feat/gnoland-txtar-driver/gno.land/cmd/gnoland/testdata

`gnoland` logs aren't forwarded to stdout to avoid overwhelming
informations in the tests. Instead, you can specify a log directory
using the `LOG_DIR` environment variable or set `TESTWORK=true` to
enable persistence in the `txtar` working directory. In either case, the
path to the log file will be printed at the start if one of these
environment variables is set.
This also enables storing logs as artifacts on the CI for later
examination.

There is still a lot to do, but I believe this provides a good base for
future iterations.

<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
Co-authored-by: Morgan <git@howl.moe>
thehowl pushed a commit that referenced this issue Jan 18, 2024
This PR add a dedicated client library for interacting seamlessly with
the Gno.land RPC API.
This library simplifies the process of querying or sending transactions
to the Gno.land RPC API and interpreting the responses.

- [x] initial structure and calls
- [x] unit test (depends on #1101)
- [x] add additional query methods
- [ ] add additional transaction methods (can/should be done later)

Closes #1324


<details><summary>Previous list of ideas</summary>

Note: Some content may be outdated. Please overlook for the moment, but
we'll reassess at the conclusion of this PR to identify any current
requirements.


- [ ] port
https://github.com/gnolang/gno/tree/master/tm2/pkg/crypto/keys/client
into a simple `./gno.land/pkg/gnoclient` package (Call, Send, AddPkg,
Query, Eval, Package, File)
- [ ] add unit tests so that crypto/keys/client can have less unit tests
and be more focused on CLI stuff
- [ ] create mock/testing helpers to make it more useful when writing
integration tests -> `./gno.land/cmd/gnoland/*_test.go`
- [ ] port a client, i.e., `gnofaucet`, `gnoweb`, `gnoblog`, etc; so
they use this new library instead of hardcoded manual clients
- [ ] consider having right now underlying `tm2client` and `gnovmclient`
libs that this lib will depend on, but will probably do it later and
start with a monolith library
- [ ] alternative configuration (pass existing websocket?)
- [ ] minimal go.mod to make it light to import
- [ ] open issue on other clients (gnoblog, discord faucet, gnomobile)
</details>

<details><summary>Contributors' checklist...</summary>

- [ ] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Signed-off-by: Jeff Thompson <jeff@thefirst.org>
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
Co-authored-by: Jeff Thompson <jeff@thefirst.org>
Co-authored-by: Guilhem Fanton <8671905+gfanton@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🌟 Wanted for Launch
Development

Successfully merging a pull request may close this issue.

2 participants