Skip to content

Commit 0041334

Browse files
pablochacinppcano
andauthored
Reorganize disruptor get-started (#1356)
* Reorganize disruptor get-started Signed-off-by: Pablo Chacin <[email protected]> Co-authored-by: Pepe Cano <[email protected]>
1 parent a26fc23 commit 0041334

File tree

5 files changed

+56
-27
lines changed

5 files changed

+56
-27
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ node_modules/
44
docs/sources/get-started/run-cloud-tests-from-the-CLI.md
55
docs/sources/get-started/run-your-first-tests.md
66
CONTRIBUTING_FILE_FORMAT.md
7-
src/data/markdown/docs/40 xk6-disruptor/01 Get started/01 Welcome.md
7+
src/data/markdown/docs/40 xk6-disruptor/01 Get started/01 First steps.md
88
src/data/markdown/docs/40 xk6-disruptor/01 Get started/04 Expose Your Application.md
99
src/data/markdown/docs/40 xk6-disruptor/04 Examples/01 Inject Grpc faults into Service.md
1010
src/data/markdown/docs/40 xk6-disruptor/04 Examples/02 Inject HTTP faults into Pod.md

gatsby-node.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ function getDocPagesProps({
672672
// add prefix to xk6-disruptor pages slugs and sidebar links
673673
if (slug.startsWith('xk6-disruptor/')) {
674674
slug = `javascript-api/${slug}`;
675-
if (slug.includes('xk6-disruptor/get-started/welcome')) {
675+
if (slug.includes('xk6-disruptor/get-started/first-steps')) {
676676
// make the section root out of the welcome page
677677
slug = `/javascript-api/xk6-disruptor/`;
678678
}
@@ -684,7 +684,7 @@ function getDocPagesProps({
684684
);
685685
replacePathsInSidebarTree(
686686
sidebarTree,
687-
'/javascript-api/xk6-disruptor/get-started/welcome',
687+
'/javascript-api/xk6-disruptor/get-started/first-steps',
688688
'/javascript-api/xk6-disruptor',
689689
);
690690

@@ -1860,7 +1860,7 @@ const createRedirects = ({ actions }) => {
18601860
'/using-k6-browser/selecting-elements/',
18611861
'/javascript-api/k6-browser/get-started/selecting-elements/':
18621862
'/using-k6-browser/selecting-elements/',
1863-
'/javascript-api/xk6-disruptor/get-started/welcome/':
1863+
'/javascript-api/xk6-disruptor/get-started/first-steps/':
18641864
'/javascript-api/xk6-disruptor/',
18651865
...newJavascriptURLsRedirects,
18661866
};

src/data/markdown/docs/40 xk6-disruptor/01 Get started/01 Welcome.md renamed to src/data/markdown/docs/40 xk6-disruptor/00 About.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Welcome'
2+
title: 'About'
33
heading: 'xk6-disruptor Documentation'
44
head_title: 'xk6-disruptor Documentation'
55
excerpt: 'xk6-disruptor is a k6 extension providing fault injection capabilities to test system reliability under turbulent conditions.'
@@ -21,24 +21,6 @@ It provides a Javascript API to inject different [faults](/javascript-api/xk6-di
2121

2222
Other types of faults and disruptors will be introduced in the future. The [Roadmap](https://github.com/grafana/xk6-disruptor/blob/main/ROADMAP.md) presents the project's goals for the coming months regarding new functionalities and enhancements.
2323

24-
```javascript
25-
export default function () {
26-
// Create a new pod disruptor with a selector
27-
// that matches pods from the "default" namespace with the label "app=my-app"
28-
const disruptor = new PodDisruptor({
29-
namespace: "default",
30-
select: { labels: { "app.kubernetes.io/name": "my-app" } },
31-
});
32-
33-
// Disrupt the targets by injecting HTTP faults into them for 30 seconds
34-
const fault = {
35-
averageDelay: 500,
36-
errorRate: 0.1,
37-
errorCode: 500
38-
}
39-
disruptor.injectHTTPFaults(fault, "30s")
40-
}
41-
```
4224

4325
## Use cases
4426

@@ -59,11 +41,15 @@ Common use cases are:
5941

6042
## Learn more
6143

62-
Check the [requirements](/javascript-api/xk6-disruptor/get-started/requirements/), [installation](/javascript-api/xk6-disruptor/get-started/installation/), and [how to expose your application](/javascript-api/xk6-disruptor/get-started/expose-your-application/) to get started with the disruptor.
44+
Lear more about [Fault injection](https://k6.io/blog/democratize-chaos-testing/) and [Building Resilience early in the development cycle](https://k6.io/blog/building-resilience-early-in-the-development-cycle/).
6345

64-
This documentation presents a few [examples of injecting faults in different scenarios](/javascript-api/xk6-disruptor/examples/).
46+
Check the [first steps](/javascript-api/xk6-disruptor/get-started/first-steps) to get started with the disruptor.
6547

66-
Also, an [interactive demo environment in Killercoda](https://killercoda.com/grafana-xk6-disruptor/scenario/killercoda) is available to use the k6 disruptor right away. You can fail the services of a demo application without having to install Kubernetes on your local machine.
48+
Follow the [examples of injecting faults in different scenarios](/javascript-api/xk6-disruptor/examples/).
49+
50+
Visit the [interactive demo environment in Killercoda](https://killercoda.com/grafana-xk6-disruptor/scenario/killercoda) and try the disruptor in a demo application without having to do any setup.
51+
52+
## Contributing
6753

6854
For any unexpected behavior, please search the [GitHub issues](https://github.com/grafana/xk6-disruptor/issues) first.
6955

src/data/markdown/docs/40 xk6-disruptor/01 Get started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ excerpt: 'xk6-disruptor is an extension that adds fault injection capabilities t
55

66
Inject faults into kubernetes-based applications with `xk6-disruptor`. Start here to learn the basics to use the disruptor:
77

8-
- [About `xk6-disruptor`](/javascript-api/xk6-disruptor/)
8+
- [First steps](/javascript-api/xk6-disruptor/get-started/first-steps)
99

1010
- [Requirements](/javascript-api/xk6-disruptor/get-started/requirements)
1111

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: 'First steps'
3+
heading: 'xk6-disruptor first steps'
4+
head_title: 'xk6-disruptor First steps'
5+
excerpt: 'xk6-disruptor is a k6 extension providing fault injection capabilities to k6.'
6+
---
7+
8+
[xk6-disruptor](https://github.com/grafana/xk6-disruptor) is an extension that adds fault injection capabilities to k6.
9+
10+
It provides a Javascript [API]((/javascript-api/xk6-disruptor/api)) to inject [faults](/javascript-api/xk6-disruptor/api/faults/) such as errors and delays into HTTP and gRPC requests served by selected Kubernetes [Pods](/javascript-api/xk6-disruptor/api/poddisruptor) or [Services](/javascript-api/xk6-disruptor/api/servicedisruptor).
11+
12+
13+
```javascript
14+
export default function () {
15+
// Create a new disruptor that targets a service
16+
const disruptor = new ServiceDisruptor("app-service","app-namespace");
17+
18+
// Disrupt the targets by injecting delays and faults into HTTP request for 30 seconds
19+
const fault = {
20+
averageDelay: '500ms',
21+
errorRate: 0.1,
22+
errorCode: 500
23+
}
24+
disruptor.injectHTTPFaults(fault, "30s")
25+
}
26+
```
27+
28+
## Next steps
29+
30+
Learn more about xk6-disruptor and fault injection in [About](/javascript-api/xk6-disruptor/about).
31+
32+
Explore the fault injection [API](/javascript-api/xk6-disruptor/api)
33+
34+
See [step-by-step examples](/javascript-api/xk6-disruptor/examples).
35+
36+
Visit the [interactive demo environment](https://killercoda.com/grafana-xk6-disruptor/scenario/killercoda).
37+
38+
Learn the basics of using the disruptor in your test project:
39+
40+
- [Requirements](/javascript-api/xk6-disruptor/get-started/requirements)
41+
42+
- [Installation](/javascript-api/xk6-disruptor/get-started/installation)
43+

0 commit comments

Comments
 (0)