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

tests: Add tests for Storage Options #994

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
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
88 changes: 45 additions & 43 deletions examples/sample-test-app3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,54 +154,56 @@ spec:
persistentVolumeClaim:
claimName: pv3-4
restartPolicy: OnFailure
# ---
# kind: StorageClass
# apiVersion: storage.k8s.io/v1
# metadata:
# name: kadalu.storage-pool-3-storage-options
# provisioner: kadalu
# parameters:
# storage_name: "storage-pool-3-with-9-pods"

---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: kadalu.storage-pool-3-storage-options
provisioner: kadalu
parameters:
storage_name: "storage-pool-3-with-3-pods"
# storage_options:
# "cluster/replicate.data-self-heal: off,\
# performance/nl-cache.nl-cache: off"

# ---
# kind: PersistentVolumeClaim
# apiVersion: v1
# metadata:
# name: pv3-5
# labels:
# type: replica3
# spec:
# storageClassName: kadalu.storage-pool-3-storage-options
# accessModes:
# - ReadWriteMany
# resources:
# requests:
# storage: 200Mi
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pv3-5
labels:
type: replica3
spec:
storageClassName: kadalu.storage-pool-3-storage-options
accessModes:
- ReadWriteMany
resources:
requests:
storage: 200Mi

# ---
# apiVersion: v1
# kind: Pod
# metadata:
# name: pod3-5
# labels:
# app: sample-app
# type: replica3
# spec:
# containers:
# - name: sample-app
# image: docker.io/kadalu/sample-pv-check-app:latest
# imagePullPolicy: IfNotPresent
# volumeMounts:
# - mountPath: "/mnt/pv"
# name: csivol
# volumes:
# - name: csivol
# persistentVolumeClaim:
# claimName: pv3-5
# restartPolicy: OnFailure
---
apiVersion: v1
kind: Pod
metadata:
name: pod3-5
labels:
app: sample-app
type: replica3
spec:
containers:
- name: sample-app
image: docker.io/kadalu/sample-pv-check-app:latest
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: "/mnt/pv"
name: csivol
command: ["/bin/sh", "-ec", "sleep 1000"]
volumes:
- name: csivol
persistentVolumeClaim:
claimName: pv3-5
restartPolicy: OnFailure

# ---
# kind: PersistentVolumeClaim
Expand Down
12 changes: 9 additions & 3 deletions tests/minikube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function wait_for_kadalu_pods() {
local end_time=$(($(date +%s) + $local_timeout))

# wait for kadalu pods creation
while [[
while [[
$($k get pod --ignore-not-found -o name -l name=kadalu | wc -l) -eq 0 ||
$($k get pod --ignore-not-found -o name -l app.kubernetes.io/name=kadalu-csi-provisioner | wc -l) -eq 0 ||
$($k get pod --ignore-not-found -o name -l app.kubernetes.io/name=kadalu-csi-nodeplugin | wc -l) -eq 0 ||
Expand Down Expand Up @@ -283,12 +283,16 @@ function run_sanity() {
check_test_fail
}

function apply_storage_options() {
kubectl apply -f tests/storage-add-with-options.yaml
}

function verify_storage_options() {
echo "List of storage-class"
kubectl get sc -nkadalu
for p in $(kubectl -n kadalu get pods -o name); do
if [[ $p == *"nodeplugin"* ]]; then
kubectl exec -i -nkadalu $p -c 'kadalu-nodeplugin' -- bash -c 'grep -e "data-self-heal off" -e "nl-cache off" /kadalu/volfiles/* | cat'
kubectl logs -nkadalu $p -c 'kadalu-logging' | grep "performance/io-threads" | cat
fi
done
}
Expand Down Expand Up @@ -458,7 +462,9 @@ case "${1:-}" in
run_sanity

# Test Storage-Options
# verify_storage_options
apply_storage_options
sleep 60
verify_storage_options

# check for test failure
check_test_fail
Expand Down
20 changes: 20 additions & 0 deletions tests/storage-add-with-options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## -------------------------------------------------------------------
# This storage is used for testing storage-options with 3 storage-pods
---
apiVersion: kadalu-operator.storage/v1alpha1
kind: KadaluStorage
metadata:
name: storage-pool-3-with-3-pods
spec:
type: Replica3
options:
- key: "performance.client-io-threads"
value: "on"
storage:
- node: minikube # node name as shown in `kubectl get nodes`
device: /mnt/DISK/file5.1 # file as a device
- node: minikube # node name as shown in `kubectl get nodes`
device: /mnt/DISK/file5.2 # file as a device
- node: minikube # node name as shown in `kubectl get nodes`
device: /mnt/DISK/file5.3 # file as a device
- node: minikube # node name as shown in `kubectl get nodes`
32 changes: 16 additions & 16 deletions tests/storage-add.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,22 @@ spec:


## -------------------------------------------------------------------
# This storage is used for testing storage-options with 9 storage-pods
# ---
# apiVersion: kadalu-operator.storage/v1alpha1
# kind: KadaluStorage
# metadata:
# name: storage-pool-3-with-9-pods
# spec:
# type: Replica3
# storage:
# - node: minikube # node name as shown in `kubectl get nodes`
# device: /mnt/DISK/file5.1 # file as a device
# - node: minikube # node name as shown in `kubectl get nodes`
# device: /mnt/DISK/file5.2 # file as a device
# - node: minikube # node name as shown in `kubectl get nodes`
# device: /mnt/DISK/file5.3 # file as a device
# - node: minikube # node name as shown in `kubectl get nodes`
# This storage is used for testing storage-options with 3 storage-pods
---
apiVersion: kadalu-operator.storage/v1alpha1
kind: KadaluStorage
metadata:
name: storage-pool-3-with-3-pods
spec:
type: Replica3
storage:
- node: minikube # node name as shown in `kubectl get nodes`
device: /mnt/DISK/file5.1 # file as a device
- node: minikube # node name as shown in `kubectl get nodes`
device: /mnt/DISK/file5.2 # file as a device
- node: minikube # node name as shown in `kubectl get nodes`
device: /mnt/DISK/file5.3 # file as a device
- node: minikube # node name as shown in `kubectl get nodes`
# device: /mnt/DISK/file5.4 # file as a device
# - node: minikube # node name as shown in `kubectl get nodes`
# device: /mnt/DISK/file5.5 # file as a device
Expand Down
Loading