Commit Graph

15 Commits

Author SHA1 Message Date
renovate[bot]
b01ad36cdb
chore(deps): update rust crate serde_json to 1.0.91 (#407)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-12-27 00:24:38 +03:00
Ivan Boldyrev
004ce10abd
Make unstable clippy happy with clippy --fix (#402)
Most of changes either move variables into `format!` templates
or remove excessive clones.
2022-12-12 22:37:05 +07:00
Ivan Boldyrev
e5837e9171
feat(testing-framework): tetraplet behavior (#396)
`behavior=tetraplet` annotation crates a service that returns call's tetraplets
2022-12-01 17:33:59 +07:00
Ivan Boldyrev
843d2a1d7b
feat(testing-framework): testing parser improvements (#375)
* Introduce multiline call annotations

Call annotations have same format as `;`-annotations, but can allow
multiline JSON literals.  They look like `#| ...  |#` (that's Common Lisp syntax for multiline comments).

For example:

```
(call "peer_id" ("serv" "func") [a b] var)  #|
      map = {
        "0": null,
        "default": 42,
      }
   |#
```

* A JSON in the assertion parser doesn't have be last

We have been using nom's `rest` for JSON values.  Now we have a simple JSON parser
that recognizes JSON to be parsed with `serde_json`, and may have multiple JSON objects
within same assertion.

* Allow annotation after a compound form

It is attached to a rightmost nested element that has to be a `call` special form.
2022-11-25 17:56:23 +07:00
Ivan Boldyrev
4e86da7eda
feat(testing-framework): Testing framework major refactoring (#372)
1. Network can be shared between several execution, being used by an Rc-handle.
2. The neighborhood is just network's all peers with removed/inserted hosts delta with respect to network.
3. An AIR script is transformed into a separate value of type `TransformedAirScript`.  It allows running several
particles on the same parsed AIR script, sharing state.
4. `TestExecutor` was renamed to `AirScriptExecutor`.  It also has a constructor that accepts a `TransformedAirScript`.
2022-11-24 23:33:55 +07:00
renovate[bot]
d3bda16e71
fix(deps): update all non-major rust dependencies (#369)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-11-24 12:54:40 +03:00
renovate[bot]
bbc521ce53
fix(deps): update all non-major rust dependencies (#338)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-15 21:08:46 +03:00
renovate[bot]
fb32f33154
chore(deps): update rust crate pretty_assertions to v1 (#361)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-10-14 12:40:12 +03:00
Ivan Boldyrev
22fac9329e
feat(testing-framework): prevalidate AIR script (#365)
Try to parse the annotated AIR script with the standard parser to catch
to catch errors early with better error messages.

We do it in the `TestExecutor` only to make testing framwork parser
tests simplier.  For user experience, it doesn't matter.
2022-10-12 13:44:59 +07:00
Ivan Boldyrev
651b569a13
feat(testing-framework): allow exclamation mark (#364)
While exclamation mark is legacy feature in the lambda parser, people
seem to use it anyway, getting errors not always easy to understand.
2022-10-11 21:52:49 +07:00
Ivan Boldyrev
076045124c
feat(testing) Testing framework chapter 1, asserts and comments (#342)
* seq_result` -> `seq_ok`; add `seq_err`

`seq_ok` and `seq_err` are consistent with `ok` and `err`, but produce
results sequentially.

* Accept `;;` and longer comments in the sexp parser

Currently they are just dropped, and resulting AIR has different
character positions in the error messages.

* Add "map" assertion

Lookup result in a map by service's first argument.
2022-10-11 01:05:20 +07:00
renovate[bot]
40bb3c843f
Update all non-major Rust dependencies (#323)
* Update all non-major Rust dependencies

* bump fluence-app-service version

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Valery Antopol <valery.antopol@gmail.com>
2022-09-13 19:03:18 +03:00
Mike Voronov
a4011ef038
Introduce length functor (#314) 2022-09-08 16:58:04 +03:00
renovate[bot]
b4195175db
Update all non-major Rust dependencies (#309)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Anatoly Laskaris <github_me@nahsi.dev>
2022-09-07 12:10:07 +03:00
Ivan Boldyrev
513eb0e126
Testing framework, chapter I (#293)
Testing framework for AquaVM

Its primary features are:
1. It generates services declaratively by annotation in the comments inserted just after calls.
2. Ephemeral network keeps each node's data and incoming data queue.  The network can be also generated based on peer IDs featured in the script.
3. One can explicitly add additional peers and services.

The example of the script annotations:
```
(seq
  (call "peer_1" ("service" "func") [] var) ; ok=42
  (call "peer_2" ("service" "func") [var]) ; err={"ret_code": 1, "result":"no towel"}
)
```

Passing this script to `air_test_framework::TestExecutor::new(...)` will create a virtual network with peers "peer_1" and "peer_2" (and any peer you provide in the `TestRunParameters`), and the particular calls will return respective values.

Please note that autogenerated services use modified service name as a side channel for finding a correct value: "..{N}" is added to each service name (two dots and serial number).  Be careful with service names taken from a variable.
2022-09-01 18:12:55 +07:00