Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grafana/xk6-docker
k6 extension for interacting with Docker containers and images from a test script.
https://github.com/grafana/xk6-docker
docker k6 xk6
Last synced: 3 months ago
JSON representation
k6 extension for interacting with Docker containers and images from a test script.
- Host: GitHub
- URL: https://github.com/grafana/xk6-docker
- Owner: grafana
- License: apache-2.0
- Archived: true
- Created: 2021-03-01T10:42:54.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-20T16:44:02.000Z (about 1 year ago)
- Last Synced: 2024-09-24T09:33:00.938Z (3 months ago)
- Topics: docker, k6, xk6
- Language: Go
- Homepage:
- Size: 1.63 MB
- Stars: 15
- Watchers: 142
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
> ### ⚠️ Deprecated!!!
>
> This extension was originally created as a _proof of concept_.
> At this time, there are no maintainers available to support this extension.
>
> USE AT YOUR OWN RISK!
# xk6-docker
A k6 extension for using of Docker CLI in testing. Built for [k6](https://go.k6.io/k6) using [xk6](https://github.com/grafana/xk6).## Build
To build a `k6` binary with this extension, first ensure you have the prerequisites:
- [Go toolchain](https://go101.org/article/go-toolchain.html)
- GitThen:
1. Download `xk6`:
```bash
$ go install go.k6.io/xk6/cmd/xk6@latest
```2. Build the binary:
```bash
$ xk6 build --with github.com/grafana/xk6-docker@latest
```## Example
```javascript
import containers from 'k6/x/docker/containers';export default function () {
containers.list().forEach((container) => {
console.log(container.id.substring(0, 10));
});
}
```Result output:
```plain
$ ./k6 run script.js/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .ioexecution: local
script: ../xk6-docker/script.js
output: -scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)INFO[0000] 32c2786ccb
INFO[0000] 738b15d70f
INFO[0000] 5813101144
INFO[0000] b1fda43ce2running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.0s/10m0s 1/1 iters, 1 per VUdata_received........: 0 B 0 B/s
data_sent............: 0 B 0 B/s
iteration_duration...: avg=9.64ms min=9.64ms med=9.64ms max=9.64ms p(90)=9.64ms p(95)=9.64ms
iterations...........: 1 25.017512/s```
Inspect [`examples`](examples) folder for more details.