PingCAP failpoint is a golang library that provides a convenient way for developer to inject error code, which is a similar implementation to FreeBSD failpoints and etcd go-fail library. While comparing to go-fail, PingCAP failpoint provides code level support for writing injection code, which makes it more easy to define fail injection and programming friendly to developer.
PingCAP failpoint has more practical features including:
- line number invariability in generated code
- high readability of generated code
- parallel tests support with context.Context
- ability of using outer scope variable in injected code without any cost
- any syntax’s support in injection code including closure, anonymous function.
With the help of PingCAP failpoint, golang developer can easily inject error or exception into code by writing injection code, which is similar to writing common logic code, and control the activation of injection by environment variable or some test condition, which makes it easy to simulate error or exception in any large scale complex golang system.
- PingCAP failpoint: https://github.com/pingcap/failpoint
- TiDB: https://github.com/pingcap/tidb
- TiDB-DM: https://github.com/pingcap/dm