Skip to content

Commit

Permalink
test: new command line script for running csi-sanity
Browse files Browse the repository at this point in the history
Created a new sanity-cli test script to be used for running tests from the command line, requires updates to .env

Signed-off-by: Joe Skazinski <[email protected]>
  • Loading branch information
jskazinski committed Oct 7, 2021
1 parent 8129575 commit 8b7d14b
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 30 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
- name: Build and Push Docker Image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
Expand Down
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# go dependencies
/vendor

# test cluster config
test/.env

# v1.x files
_legacy

Expand All @@ -17,4 +14,8 @@ seagate-exos-x-csi-controller
# vs code
.vscode/

node_modules/
node_modules/

# test files
test/secrets.yml
test/volume.yml
16 changes: 16 additions & 0 deletions test/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Fill in all values below using the example as a template.
# Passwords with special characters must be escaped and quoted.
#
# Example:
# TEST_USERNAME=username
# TEST_PASSWORD=\"\!password\"
# TEST_IP=http://1.2.3.4
# TEST_POOL=A|B
# TEST_FSTYPE=ext3|ext4|xfs
#
TEST_USERNAME=
TEST_PASSWORD=
TEST_IP=
TEST_POOL=
TEST_FSTYPE=
3 changes: 0 additions & 3 deletions test/.env-example

This file was deleted.

56 changes: 56 additions & 0 deletions test/sanity-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#! /usr/bin/env bash

echo ""
echo "[] sanity-cli"

secretsTemplate="secrets.template.yml"
secrets="secrets.yml"
volumeTemplate="volume.template.yml"
volume="volume.yml"

set -e

function pause()
{
echo ""
read -s -n 1 -p "===== Press any key to contine ====="
echo ""
}

function setup {
cd $(dirname $0)
set -a; . .env; set +a

echo ""

envsubst < ${secretsTemplate} > ${secrets}
echo "===== ${secrets} ====="
cat ${secrets}
echo "===== END ====="

echo ""

envsubst < ${volumeTemplate} > ${volume}
echo "===== ${volume} ====="
cat ${volume}
echo "===== END ====="
}

setup
pause

controller=unix:///var/run/csi-exos-x.seagate.com/csi-controller.sock
node=unix:///var/run/csi-exos-x.seagate.com/csi-node.sock
sanity=/home/seagate/github.com/kubernetes-csi/csi-test/cmd/csi-sanity/csi-sanity
focus="CreateVolume"
focus="DeleteVolume"
focus=""

echo ""
echo "[] csi-sanity"
echo "sudo ${sanity} -csi.controllerendpoint ${controller} -csi.endpoint ${node} -csi.secrets ${secrets} -ginkgo.focus \"${focus}\" -csi.testvolumeparameters ${volume} -ginkgo.failFast > sanity.log"
sudo ${sanity} -csi.controllerendpoint ${controller} -csi.endpoint ${node} -csi.secrets ${secrets} -ginkgo.focus "${focus}" -csi.testvolumeparameters ${volume} -ginkgo.failFast > sanity.log

out=$?

exit ${out}
File renamed without changes.
42 changes: 21 additions & 21 deletions test/secrets.template.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
CreateVolumeSecret:
username: $STORAGE_USERNAME
password: $STORAGE_PASSWORD
apiAddress: $STORAGE_API_ADDR
username: $TEST_USERNAME
password: $TEST_PASSWORD
apiAddress: $TEST_IP
DeleteVolumeSecret:
username: $STORAGE_USERNAME
password: $STORAGE_PASSWORD
apiAddress: $STORAGE_API_ADDR
username: $TEST_USERNAME
password: $TEST_PASSWORD
apiAddress: $TEST_IP
ControllerPublishVolumeSecret:
username: $STORAGE_USERNAME
password: $STORAGE_PASSWORD
apiAddress: $STORAGE_API_ADDR
username: $TEST_USERNAME
password: $TEST_PASSWORD
apiAddress: $TEST_IP
ControllerUnpublishVolumeSecret:
username: $STORAGE_USERNAME
password: $STORAGE_PASSWORD
apiAddress: $STORAGE_API_ADDR
username: $TEST_USERNAME
password: $TEST_PASSWORD
apiAddress: $TEST_IP
NodeStageVolumeSecret:
username: $STORAGE_USERNAME
password: $STORAGE_PASSWORD
apiAddress: $STORAGE_API_ADDR
username: $TEST_USERNAME
password: $TEST_PASSWORD
apiAddress: $TEST_IP
NodePublishVolumeSecret:
username: $STORAGE_USERNAME
password: $STORAGE_PASSWORD
apiAddress: $STORAGE_API_ADDR
username: $TEST_USERNAME
password: $TEST_PASSWORD
apiAddress: $TEST_IP
ControllerValidateVolumeCapabilitiesSecret:
username: $STORAGE_USERNAME
password: $STORAGE_PASSWORD
apiAddress: $STORAGE_API_ADDR
username: $TEST_USERNAME
password: $TEST_PASSWORD
apiAddress: $TEST_IP
2 changes: 2 additions & 0 deletions test/volume.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pool: $TEST_POOL
fsType: $TEST_FSTYPE

0 comments on commit 8b7d14b

Please sign in to comment.