|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2025 The Kubernetes Authors. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -o xtrace |
| 18 | +set -o errexit |
| 19 | +set -o pipefail |
| 20 | +set -o nounset |
| 21 | + |
| 22 | +readonly volname="citest-$(date +%s)" |
| 23 | +readonly volsize="2147483648" |
| 24 | +readonly endpoint="unix:///csi/csi.sock" |
| 25 | +readonly target_path="/tmp/target_path" |
| 26 | +readonly lustre_fs_ip=1.2.3.4 |
| 27 | + |
| 28 | +mkdir -p $target_path |
| 29 | + |
| 30 | +apt-get update |
| 31 | +apt-get install -y --no-install-recommends kmod wget git ca-certificates lsb-release gpg curl |
| 32 | +update-ca-certificates |
| 33 | + |
| 34 | +curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null |
| 35 | +echo "deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/22.04/prod jammy main" | tee /etc/apt/sources.list.d/amlfs.list |
| 36 | +apt-get update |
| 37 | + |
| 38 | +# This should match the version of Go that is used to build the CSI driver |
| 39 | +apt install -y msft-golang=${MSFT_GOLANG_PKG_VER} |
| 40 | + |
| 41 | +go version |
| 42 | + |
| 43 | +lctl network up || true |
| 44 | +echo "$(date -u) Enabled Lustre client kernel modules." |
| 45 | + |
| 46 | +echo "$(date -u) Entering Lustre CSI driver" |
| 47 | + |
| 48 | +echo "$(date -u) install csc" |
| 49 | +go install github.com/dell/gocsi/csc@latest |
| 50 | +export PATH=$PATH:/root/go/bin # add csc to path |
| 51 | + |
| 52 | +mkdir /csi |
| 53 | +echo "$(date -u) Exiting Lustre CSI driver" |
| 54 | +nohup 2>&1 /app/azurelustreplugin --v=5 \ |
| 55 | + --endpoint=${endpoint} \ |
| 56 | + --enable-azurelustre-mock-mount \ |
| 57 | + --nodeid=integrationtestnode >csi.log & |
| 58 | + |
| 59 | +sleep 5 |
| 60 | + |
| 61 | +echo "====: $(date -u) Exiting integration test" |
| 62 | +export X_CSI_DEBUG=true |
| 63 | +echo "====: $(date -u) Create volume test:" |
| 64 | +value="$(csc controller new --endpoint "${endpoint}" \ |
| 65 | + --cap MULTI_NODE_MULTI_WRITER,mount,,, \ |
| 66 | + "${volname}" \ |
| 67 | + --req-bytes "${volsize}" \ |
| 68 | + --params fs-name=lustrefs,mgs-ip-address="${lustre_fs_ip}")" |
| 69 | +sleep 5 |
| 70 | + |
| 71 | +volumeid="$(echo "$value" | awk '{print $1}' | sed 's/"//g')" |
| 72 | +echo "====: $(date -u) Volume ID is $volumeid" |
| 73 | + |
| 74 | +echo "====: $(date -u) Validate volume capabilities test:" |
| 75 | +csc controller validate-volume-capabilities --endpoint "${endpoint}" \ |
| 76 | + --cap MULTI_NODE_MULTI_WRITER,mount,,, \ |
| 77 | + "$volumeid" |
| 78 | + |
| 79 | +echo "====: $(date -u) stats test:" |
| 80 | +csc node stats --endpoint "${endpoint}" "${volumeid}:${target_path}" |
| 81 | +sleep 2 |
| 82 | + |
| 83 | +echo "====: $(date -u) Node publish volume test:" # Requires routng to amlfs |
| 84 | +csc node publish --endpoint "${endpoint}" \ |
| 85 | + --cap MULTI_NODE_MULTI_WRITER,mount,,, \ |
| 86 | + --target-path "${target_path}" \ |
| 87 | + --vol-context "fs-name=lustrefs,mgs-ip-address=${lustre_fs_ip}" \ |
| 88 | + "${volumeid}" |
| 89 | +sleep 3 |
| 90 | + |
| 91 | +echo "====: $(date -u) Node unpublish volume test:" # Requires routng to amlfs |
| 92 | +csc node unpublish --endpoint "${endpoint}" \ |
| 93 | + --target-path "$target_path" \ |
| 94 | + "$volumeid" |
| 95 | + |
| 96 | +echo "====: $(date -u) Delete volume test:" |
| 97 | +csc controller del --endpoint "${endpoint}" "$volumeid" |
| 98 | + |
| 99 | +echo "====: $(date -u) Identity test:" |
| 100 | +csc identity plugin-info --endpoint "${endpoint}" |
| 101 | + |
| 102 | +echo "====: $(date -u) Node get info test:" |
| 103 | +csc node get-info --endpoint "${endpoint}" |
| 104 | + |
| 105 | +echo "$(date -u) Integration test on aks is completed." |
0 commit comments