-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from pablochacin/add-helpers
Add helpers
- Loading branch information
Showing
16 changed files
with
1,591 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Kubernetes } from 'k6/x/kubernetes'; | ||
|
||
let pod = { | ||
apiVersion: "v1", | ||
kind: "Pod", | ||
metadata: { | ||
name: "busybox", | ||
namespace: "default" | ||
}, | ||
spec: { | ||
containers: [ | ||
{ | ||
name: "busybox", | ||
image: "busybox", | ||
command: ["sh", "-c", "sleep 30"] | ||
} | ||
] | ||
} | ||
} | ||
|
||
export default function () { | ||
const kubernetes = new Kubernetes(); | ||
|
||
const ns = "default" | ||
|
||
// create pod in test namespace | ||
pod.metadata.namespace = ns | ||
kubernetes.create(pod) | ||
|
||
// get helpers for test namespace | ||
const helpers = kubernetes.helpers(ns) | ||
|
||
// wait for pod to be running | ||
const timeout = 10 | ||
if (!helpers.waitPodRunning(pod.metadata.name, timeout)) { | ||
console.log(`"pod ${pod.metadata.name} not ready after ${timeout} seconds`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.