Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize disruptor get-started #1356

Merged
merged 3 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_modules/
docs/sources/get-started/run-cloud-tests-from-the-CLI.md
docs/sources/get-started/run-your-first-tests.md
CONTRIBUTING_FILE_FORMAT.md
src/data/markdown/docs/40 xk6-disruptor/01 Get started/01 Welcome.md
src/data/markdown/docs/40 xk6-disruptor/01 Get started/01 First steps.md
src/data/markdown/docs/40 xk6-disruptor/01 Get started/04 Expose Your Application.md
src/data/markdown/docs/40 xk6-disruptor/04 Examples/01 Inject Grpc faults into Service.md
src/data/markdown/docs/40 xk6-disruptor/04 Examples/02 Inject HTTP faults into Pod.md
Expand Down
6 changes: 3 additions & 3 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ function getDocPagesProps({
// add prefix to xk6-disruptor pages slugs and sidebar links
if (slug.startsWith('xk6-disruptor/')) {
slug = `javascript-api/${slug}`;
if (slug.includes('xk6-disruptor/get-started/welcome')) {
if (slug.includes('xk6-disruptor/get-started/first-steps')) {
// make the section root out of the welcome page
slug = `/javascript-api/xk6-disruptor/`;
}
Expand All @@ -684,7 +684,7 @@ function getDocPagesProps({
);
replacePathsInSidebarTree(
sidebarTree,
'/javascript-api/xk6-disruptor/get-started/welcome',
'/javascript-api/xk6-disruptor/get-started/first-steps',
'/javascript-api/xk6-disruptor',
);

Expand Down Expand Up @@ -1860,7 +1860,7 @@ const createRedirects = ({ actions }) => {
'/using-k6-browser/selecting-elements/',
'/javascript-api/k6-browser/get-started/selecting-elements/':
'/using-k6-browser/selecting-elements/',
'/javascript-api/xk6-disruptor/get-started/welcome/':
'/javascript-api/xk6-disruptor/get-started/first-steps/':
'/javascript-api/xk6-disruptor/',
...newJavascriptURLsRedirects,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Welcome'
title: 'About'
heading: 'xk6-disruptor Documentation'
head_title: 'xk6-disruptor Documentation'
excerpt: 'xk6-disruptor is a k6 extension providing fault injection capabilities to test system reliability under turbulent conditions.'
Expand All @@ -21,24 +21,6 @@ It provides a Javascript API to inject different [faults](/javascript-api/xk6-di

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.

```javascript
export default function () {
// Create a new pod disruptor with a selector
// that matches pods from the "default" namespace with the label "app=my-app"
const disruptor = new PodDisruptor({
namespace: "default",
select: { labels: { "app.kubernetes.io/name": "my-app" } },
});

// Disrupt the targets by injecting HTTP faults into them for 30 seconds
const fault = {
averageDelay: 500,
errorRate: 0.1,
errorCode: 500
}
disruptor.injectHTTPFaults(fault, "30s")
}
```

## Use cases

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

## Learn more

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.
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/).

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

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.
Follow the [examples of injecting faults in different scenarios](/javascript-api/xk6-disruptor/examples/).

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.

## Contributing

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ excerpt: 'xk6-disruptor is an extension that adds fault injection capabilities t

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

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

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: 'First steps'
heading: 'xk6-disruptor first steps'
head_title: 'xk6-disruptor First steps'
excerpt: 'xk6-disruptor is a k6 extension providing fault injection capabilities to k6.'
---

[xk6-disruptor](https://github.com/grafana/xk6-disruptor) is an extension that adds fault injection capabilities to k6.

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).


```javascript
export default function () {
// Create a new disruptor that targets a service
const disruptor = new ServiceDisruptor("app-service","app-namespace");

// Disrupt the targets by injecting delays and faults into HTTP request for 30 seconds
const fault = {
averageDelay: '500ms',
errorRate: 0.1,
errorCode: 500
}
disruptor.injectHTTPFaults(fault, "30s")
}
```

## Next steps

Learn more about xk6-disruptor and fault injection in [About](/javascript-api/xk6-disruptor/about).

Explore the fault injection [API](/javascript-api/xk6-disruptor/api)

See [step-by-step examples](/javascript-api/xk6-disruptor/examples).

Visit the [interactive demo environment](https://killercoda.com/grafana-xk6-disruptor/scenario/killercoda).

Learn the basics of using the disruptor in your test project:

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

- [Installation](/javascript-api/xk6-disruptor/get-started/installation)

Loading