Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Praveenrajmani committed Oct 1, 2024
1 parent 14c5b8e commit 0a6399c
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 175 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/functests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,10 @@ jobs:
while kubectl get pods -n kube-system --no-headers | grep -vqw Running; do echo "Waiting for Minikube pods to be ready"; sleep 3; done
while kubectl get nodes --no-headers | grep -vqw Ready; do echo "Waiting for Minikube node to be ready"; sleep 3; done
- name: Configure kustomize
- name: Enable kustomize
if: contains(fromJson('['v1.24.17', 'v1.25.16', 'v1.26.15', 'v1.27.15', 'v1.28.11', 'v1.29.6', 'v1.30.2']'), matrix.kube-version)
run: |
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
# image_with_digest=$(docker inspect --format='{{index .RepoDigests 0}}' quay.io/minio/directpv:${VERSION})
# export DIGEST=${image_with_digest##*@}
envsubst < functests/base/kustomize-template.yaml > functests/base/kustomization.yaml
cat functests/base/kustomization.yaml
- name: Run kustomize tests
run: |
functests/run-tests-kustomize.sh
echo "KUSTOMIZE=true" >> $GITHUB_ENV
- name: Run tests
run: |
Expand Down
9 changes: 0 additions & 9 deletions functests/base/kustomize-template.yaml

This file was deleted.

33 changes: 27 additions & 6 deletions functests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,19 @@ function install_directpv_kustomize() {
directpv_client="$1"
echo "* Installing DirectPV via kustomize"

kubectl apply -k base/
cat > kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../resources/base
images:
- name: quay.io/minio/directpv
newTag: ${VERSION}
EOF

kubectl kustomize | kubectl apply -f -

required_count="$2"
running_count=0
Expand Down Expand Up @@ -183,15 +195,24 @@ function uninstall_directpv() {
return 0
}

# uninstall_directpv_kustomize <plugin> <pod_count>
# uninstall_directpv_kustomize <pod_count>
function uninstall_directpv_kustomize() {
directpv_client="$1"

echo "* Uninstalling DirectPV via kustomize"

# delete hangs sometimes even after the resources are deleted
timeout 15s kubectl delete -k base/
cat > kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../resources/base
images:
- name: quay.io/minio/directpv
newTag: ${VERSION}
EOF
# delete hangs sometimes even after the resources are deleted
kubectl kustomize | timeout 15s kubectl delete -f -

pending="$2"
while [[ $pending -gt 0 ]]; do
echo " ...waiting for ${pending} DirectPV pods to go down"
Expand Down
43 changes: 0 additions & 43 deletions functests/kustomize-tests.sh

This file was deleted.

9 changes: 0 additions & 9 deletions functests/legacy/kustomize-template.yaml

This file was deleted.

72 changes: 0 additions & 72 deletions functests/migration-tests-kustomize.sh

This file was deleted.

24 changes: 0 additions & 24 deletions functests/run-tests-kustomize.sh

This file was deleted.

12 changes: 10 additions & 2 deletions functests/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ function run_tests() {
setup_lvm
setup_luks
pod_count=$(( 3 + ACTIVE_NODES ))
install_directpv "${DIRECTPV_DIR}/kubectl-directpv" "${pod_count}"
if [ "${KUSTOMIZE}" == "true" ]; then
install_directpv_kustomize "${DIRECTPV_DIR}/kubectl-directpv" "${pod_count}"
else
install_directpv "${DIRECTPV_DIR}/kubectl-directpv" "${pod_count}"
fi
add_drives "${DIRECTPV_DIR}/kubectl-directpv"
deploy_minio minio.yaml
test_force_delete
Expand All @@ -34,7 +38,11 @@ function run_tests() {
uninstall_minio "${DIRECTPV_DIR}/kubectl-directpv" minio.yaml
test_volume_expansion "${DIRECTPV_DIR}/kubectl-directpv" sleep.yaml
remove_drives "${DIRECTPV_DIR}/kubectl-directpv"
uninstall_directpv "${DIRECTPV_DIR}/kubectl-directpv" "${pod_count}"
if [ "${KUSTOMIZE}" == "true" ]; then
uninstall_directpv_kustomize "${pod_count}"
else
uninstall_directpv "${DIRECTPV_DIR}/kubectl-directpv" "${pod_count}"
fi
unmount_directpv
remove_luks
remove_lvm
Expand Down

0 comments on commit 0a6399c

Please sign in to comment.