explosives 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/index.js +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# explosives
|
|
2
|
+
|
|
3
|
+
Controlled fault-injection and chaos testing toolkit for Node.js services.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Define named failure scenarios (delays, errors, drops) and scope them by environment.
|
|
8
|
+
- Runtime triggers, probabilistic injection, and scheduled blasts for integration and staging tests.
|
|
9
|
+
- Integrations for Express middleware, test-harness hooks, and a CLI runner for CI.
|
|
10
|
+
- Safe-by-default operation with dry-run mode and environment restrictions.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
`npm install explosives`
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
const Explosives = require('explosives');
|
|
20
|
+
const ex = new Explosives({ env: process.env.NODE_ENV || 'development' });
|
|
21
|
+
|
|
22
|
+
// register a scenario
|
|
23
|
+
ex.scenario('slow-db', {
|
|
24
|
+
type: 'delay', // delay, error, drop, or custom
|
|
25
|
+
target: 'db.query', // logical target name
|
|
26
|
+
delayMs: 2000,
|
|
27
|
+
probability: 0.5,
|
|
28
|
+
environments: ['staging', 'test']
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// apply injection at a call site
|
|
32
|
+
async function query(sql) {
|
|
33
|
+
await ex.applyIf('slow-db'); // only injects when scenario matches
|
|
34
|
+
return db.query(sql);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Express middleware integration (injects based on request metadata)
|
|
38
|
+
const express = require('express');
|
|
39
|
+
const app = express();
|
|
40
|
+
app.use(ex.expressMiddleware());
|
|
41
|
+
|
|
42
|
+
// CLI usage for scheduled blasts: `explosives blast --scenario slow-db --once`
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
MIT
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// explosives
|
|
1
|
+
// explosives — Controlled fault-injection and chaos testing toolkit for Node.js services.
|
|
2
2
|
module.exports = {};
|
package/package.json
CHANGED