From bf27b0f5c463942ab50760dd076c808752570ea3 Mon Sep 17 00:00:00 2001 From: Satoru Takeuchi Date: Fri, 17 Apr 2020 22:37:22 +0900 Subject: [PATCH 1/2] ceph: allow to set the device for OSD in the integration test The device name for OSD is fixed to /dev/xvdc. It works fine in the CI. However, the name would be different in the developer's local environment. Signed-off-by: Satoru Takeuchi --- Jenkinsfile | 5 +++-- tests/framework/installer/ceph_installer.go | 6 +++++- tests/scripts/localPathPV.sh | 14 ++++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cf305b6c8..bf1844b8d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -190,7 +190,7 @@ def RunIntegrationTest(k, v) { sh '''#!/bin/bash export KUBECONFIG=$HOME/admin.conf tests/scripts/helm.sh up - tests/scripts/localPathPV.sh''' + tests/scripts/localPathPV.sh /dev/xvdc''' try{ echo "Running full regression" sh '''#!/bin/bash @@ -202,7 +202,8 @@ def RunIntegrationTest(k, v) { TEST_BASE_DIR="WORKING_DIR" \ TEST_LOG_COLLECTION_LEVEL='''+"${env.getLogs}"+''' \ STORAGE_PROVIDER_TESTS='''+"${env.testProvider}"+''' \ - TEST_ARGUMENTS='''+"${env.testArgs}"+''' + TEST_ARGUMENTS='''+"${env.testArgs}"+''' \ + TEST_SCRATCH_DEVICE=/dev/xvdc kubectl config view _output/tests/linux_amd64/integration -test.v -test.timeout 7200s 2>&1 | tee _output/tests/integrationTests.log''' } diff --git a/tests/framework/installer/ceph_installer.go b/tests/framework/installer/ceph_installer.go index 67a351c93..df3f5dd9f 100644 --- a/tests/framework/installer/ceph_installer.go +++ b/tests/framework/installer/ceph_installer.go @@ -758,6 +758,10 @@ func (h *CephInstaller) WipeClusterDisks(namespace string) error { // (non-boot) disks on a node, allowing Ceph to use the disk(s) during its testing. func (h *CephInstaller) GetDiskWipeJob(nodeName, jobName, namespace string) string { // put the wipe job in the cluster namespace so that logs get picked up in failure conditions + scratchDevice := os.Getenv("TEST_SCRATCH_DEVICE") + if scratchDevice == "" { + scratchDevice = "/dev/xvdc" + } return `apiVersion: batch/v1 kind: Job metadata: @@ -821,7 +825,7 @@ spec: done # Wipe the specific disk in the CI that was running in raw mode set +Ee - block=/dev/xvdc + block=` + scratchDevice + ` wipefs --all "$block" dd if=/dev/zero of="$block" bs=1M count=100 oflag=direct,dsync set -Ee diff --git a/tests/scripts/localPathPV.sh b/tests/scripts/localPathPV.sh index d64166708..3152279ba 100755 --- a/tests/scripts/localPathPV.sh +++ b/tests/scripts/localPathPV.sh @@ -1,5 +1,15 @@ #!/bin/bash +test_scratch_device=/dev/xvdc +if [ $# -ge 1 ] ; then + test_scratch_device=$1 +fi + +if [ ! -b "${test_scratch_device}" ] ; then + echo "invalid scratch device name: ${test_scratch_device}" >&2 + exit 1 +fi + lsblk random_string=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 8) @@ -103,7 +113,7 @@ spec: persistentVolumeReclaimPolicy: Retain volumeMode: Block local: - path: "/dev/xvdc" + path: "${test_scratch_device}" nodeAffinity: required: nodeSelectorTerms: @@ -119,4 +129,4 @@ metadata: name: manual provisioner: kubernetes.io/no-provisioner volumeBindingMode: WaitForFirstConsumer -eof \ No newline at end of file +eof From a860aa445eeda748590f1975cc2bac68c2dda3d1 Mon Sep 17 00:00:00 2001 From: Satoru Takeuchi Date: Fri, 17 Apr 2020 21:47:50 +0900 Subject: [PATCH 2/2] ceph: describe the desired kernel version in the integration test The integration test certainly fails with linux kernel v4.4.x, the default kernel of Ubuntu 16.04. It succeeds with the linux kernel v4.8.x that can be got by apt-get. Let's declare this as the desired version. Signed-off-by: Satoru Takeuchi --- tests/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/README.md b/tests/README.md index fa4537b13..6cd859bff 100644 --- a/tests/README.md +++ b/tests/README.md @@ -6,9 +6,10 @@ quickly spin up a Kubernetes cluster.The Test framework is designed to install R ## Requirements 1. Docker version => 1.2 && < 17.0 (for other alternatives, see below) -2. Ubuntu 16 (the framework has only been tested on this version) -3. Kubernetes with kubectl configured -4. Rook +1. Ubuntu 16 (the framework has only been tested on this version) +1. kernel >= 4.8 +1. Kubernetes with kubectl configured +1. Rook ## Instructions