Skip to content

Commit

Permalink
update design doc to cover the examples of setting multiple failpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Nov 22, 2022
1 parent da0f9de commit b475efa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ The static way is to set [gofail terms](#gofail-term) using environment variable
$ GOFAIL_FAILPOINTS='my/package/path/SomeFuncString=sleep("600s")' ./cmd
```

You can set multiple failpoints by using ";" as the delimiter,
```
GOFAIL_FAILPOINTS='failpoint1=return("hello");failpoint2=sleep(10)' ./cmd
```

The dynamic way is to set an HTTP endpoint using environment variable `GOFAIL_HTTP` when starting your application,
and add [gofail terms](#gofail-term) via the endpoint afterwards. See example below,
```
Expand All @@ -56,6 +61,11 @@ $ GOFAIL_HTTP="127.0.0.1:22381 ./cmd
$ curl http://127.0.0.1:22381/my/package/path/SomeFuncString -XPUT -d'sleep("600s")'
```

Similarly, you can set multiple failpoints using endpoint `/failpoints`,
```
curl http://127.0.0.1:22381/failpoints -X PUT -d'failpoint1=return("hello");failpoint2=sleep(10)'
```

## Generated code
### Overview
`gofail enable <optional_file_or_dir_list>` makes the following two changes for each provided go source file, which contains the "gofail" comments,
Expand Down

0 comments on commit b475efa

Please sign in to comment.