Skip to content

Commit

Permalink
tests: Add tests for Storage Options
Browse files Browse the repository at this point in the history
Signed-off-by: Shree Vatsa N <vatsa@kadalu.tech>
  • Loading branch information
vatsa287 committed May 3, 2023
1 parent d577e4d commit 125dabe
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 19 deletions.
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

0 comments on commit 125dabe

Please sign in to comment.