Error injections - tsafin/tarantool GitHub Wiki
Setting error injections via environment variables.
It is possible to set errinjs using environment variables(further just env). Create env with the same name as error injection name in errinj.h (e.g.: ERRINJ_TESTING, ERRINJ_WAL_IO and etc.) and assign it to a value satisfied to such rules:
- For boolean error injections "true" or "false" in any case;
- For integer error injections it should be an integer number ("2", "-3" and etc.);
- For double error injections it should be a float number with decimal point as '.' ("2.45", "-2.45");
If value of env breaks the rules above then tarantool
will report it and exit.
NOTE: This function works only in Debug version as error injections at all.
Examples:
- Correct names:
$ ERRINJ_TESTING=True ERRINJ_WAL_WRITE_PARTIAL=1 ERRINJ_RELAY_TIMEOUT=2.3 tarantool
Tarantool 2.8.0-104-ga801f9f35
type 'help' for interactive help
tarantool> box.error.injection.get('ERRINJ_TESTING')
---
- true
...
tarantool> box.error.injection.get('ERRINJ_WAL_WRITE_PARTIAL')
---
- 1
...
tarantool> box.error.injection.get('ERRINJ_RELAY_TIMEOUT')
---
- 2.3
...
- Incorrect names:
$ ERRINJ_WAL_WRITE_PARTIAL=1e10 tarantool
Incorrect value for integer ERRINJ_WAL_WRITE_PARTIAL: 1e10
$ ERRINJ_RELAY_TIMEOUT=2,3 tarantool
Incorrect value for double ERRINJ_RELAY_TIMEOUT: 2,3
$ ERRINJ_TESTING=Tru tarantool
Incorrect value for boolean ERRINJ_TESTING: Tru