Skip to content

Commit 104f6df

Browse files
authored
Merge pull request #76 from grafana/petewall/minikube-driver-flag
Add args and driver to minikube
2 parents 137a0cc + 06bfe61 commit 104f6df

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

tools/helm-test/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ This section defines the Kubernetes cluster to be created and used for testing.
7979

8080
#### Minikube
8181

82-
No additional options are available. Notes that only one Minikube cluster can be created at a time.
82+
| Field | Description | Required | Default |
83+
|------------------|--------------------------------------------------------------------|----------|---------|
84+
| `cluster.driver` | The driver to use for Minikube (e.g. `virtualbox`, `qemu`, `docker`) | No | |
85+
| `cluster.args` | Additional arguments to pass to `minikube start` | No | `[]` |
86+
87+
Note that only one Minikube cluster can be created at a time.
8388

8489
### Dependencies
8590

tools/helm-test/includes/cluster/minikube.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
#!/usr/bin/env bash
22

33
createMinikubeCluster() {
4+
local testPlan=$1
45
command=(minikube start)
6+
7+
driver="$(yq eval -r '.cluster.driver' "${testPlan}")"
8+
if [ "${driver}" != "null" ] && [ -n "${driver}" ]; then
9+
command+=("--driver=${driver}")
10+
fi
11+
12+
argsString="$(yq eval -r -o=json '.cluster.args // [] | join(" ")' "${testPlan}")"
13+
if [ "${argsString}" != "null" ] && [ -n "${argsString}" ]; then
14+
IFS=" " read -r -a args <<< "${argsString}"
15+
command+=("${args[@]}")
16+
fi
17+
518
if ! minikube status; then
619
echo "${command[@]}"
720
"${command[@]}"

0 commit comments

Comments
 (0)