mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: support for functions testing (#379)
* fn: add test framework * fn: make routes creation smarter * fn: add testframework examples * fn: remove unnecessary dependency * fn: update doc * fn: fix consistenty between runff, runlocaltest and runremotetest
This commit is contained in:
committed by
Seif Lotfy سيف لطفي
parent
49cc0f6533
commit
28f713ed11
@@ -27,7 +27,8 @@ build:
|
||||
route updated to use it.
|
||||
|
||||
`path` (optional) allows you to overwrite the calculated route from the path
|
||||
position. You may use it to override the calculated route.
|
||||
position. You may use it to override the calculated route. If you plan to use
|
||||
`fn test --remote=""`, this is mandatory.
|
||||
|
||||
`version` represents current version of the function. When deploying, it is
|
||||
appended to the image as a tag.
|
||||
@@ -47,4 +48,32 @@ during functions execution.
|
||||
|
||||
`build` (optional) is an array of shell calls which are used to helping building
|
||||
the image. These calls are executed before `fn` calls `docker build` and
|
||||
`docker push`.
|
||||
`docker push`.
|
||||
|
||||
## Testing functions
|
||||
|
||||
`tests` (optional) is an array of tests that can be used to valid functions both
|
||||
locally and remotely. It has the following structure
|
||||
|
||||
```yaml
|
||||
tests:
|
||||
- name: envvar
|
||||
in: "inserted stdin"
|
||||
out: "expected stdout"
|
||||
err: "expected stderr"
|
||||
env:
|
||||
envvar: trololo
|
||||
```
|
||||
|
||||
`in` (optional) is a string that is going to be sent to the file's declared
|
||||
function.
|
||||
|
||||
`out` (optional) is the expected output for this function test. It is present
|
||||
both in local and remote executions.
|
||||
|
||||
`err` (optional) similar to `out`, however it read from `stderr`. It is only
|
||||
available for local machine tests.
|
||||
|
||||
`env` (optional) is a map of environment variables that are injected during
|
||||
tests.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user