Commit Graph

14 Commits

Author SHA1 Message Date
Fintan Halpenny 47a440a384
radicle: expose shared logger
To be able to use log setup across the different components of
heartwood, expose a `logger` module from `radicle`. This also includes
a `test` logger.

These modules are guarded behind a `logger` feature flag, so that
other crates are not bringing any uneeded dependencies.

This allows logging to be setup in `radicle-cli-test` so that when a
test fails, the log output is present for debugging purposes.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-20 15:11:10 +01:00
cloudhead 7acd025d7f
cli: Make sure envs don't bleed
Previously, if you set an env var in one test, it could also appear in a
later test. This ensures we don't persist envs between tests.
2023-11-23 11:07:07 +01:00
cloudhead 2fc65def46
cli-test: Create dirs automatically 2023-11-22 11:29:44 +01:00
cloudhead 2d79eecd66
cli-test: Update framework with new features
* Ability to switch between environments within the same test file
* Ability to expand env vars in `cd` command
2023-08-04 12:23:49 +02:00
Alexis Sellier d4e073fe4e
cli-test: Add easy file creation syntax
Eg. the following will create `FILE.txt`:

``` ./FILE.txt
Some content...
```
2023-06-22 11:15:42 +02:00
Alexis Sellier 97f122c451
cli-test: Build radicle binaries automatically
To avoid having to call `cargo build` before running the tests, we build
the necessary binaries automatically using the `escargot` crate.
2023-05-31 17:21:12 +02:00
Slack Coder dc709da33f
cli-test: Respect CARGO_TARGET_DIR
Fix an error where cli-test would fail if CARGO_TARGET_DIR was being
used.
2023-05-14 13:50:59 +02:00
Alexis Sellier dd7d86abb0
cli: Update examples to use new `fail` decorator 2023-05-12 12:54:21 +02:00
Alexis Sellier ff9903bf96
cli-test: Various improvements
* Add `stderr` decorator to assert stderr output of commands instead of
  stdout.
* Add ability to set env vars on a per-test-block basis.
* Add `fail` decorator when a failure code is expected.
* Look for binaries in cargo target dir first.
2023-05-12 11:09:21 +02:00
Alexis Sellier 7d72b16087
cli: Call `rad sync` on `git push rad`
Instead of `Node::announce_refs`, we call `rad sync` to have the
terminal block while waiting for nodes to fetch the changes.

We also change the use of `git push` in the patch command to not
trigger syncing in that case.
2023-04-25 12:46:25 +02:00
Slack Coder 11d10b4e47
cli-test: Support '[..]'s which preserve spacing
By mapping all '[.. ]'s  with any number of spaces inside them into
'[..]'s, examples can preserve text formatting while using this glob
pattern.

The downside is failed output will show '[..]' in place of the original
version with spaces.
2023-04-20 16:52:20 +02:00
Alexis Sellier b33fb2a33d
cli-test: Improve testing framework logging
Show which file is being run.
2023-03-13 11:38:33 +01:00
Alexis Sellier 0a93fa833e
cli: Simplify & improve CLI output
Improvements to the CLI output as well as converging towards
`termion` as a backend.

The crates we were using for prompting and spinners were based on
a terminal backend called `console`, which is not really used
anywhere else. There were also limitations in terms of the output
of these crates.

Therefore, we switched to the `inquire` crate for prompting, using
the `termion` backend, which is very standard.

Additionally, we simplify the terminal output to use symbols:

! for Warning
✓ for Success
✗ for Error

... Instead of a mix of words and symbols.

We also include a modified version of the `yansi` crate which plays
well with our table formatting functions by automatically truncating
and padding output in a unicode-aware way.
2023-02-27 17:10:52 +01:00
xla 97f7064094 cli: Extract crate for md based tests
To allow that functionality to be published for reuse.

Signed-off-by: xla <self@xla.is>
2023-02-15 15:25:38 +11:00