ceph: prepare PVCs for OSD on PVC test inside the integration test

The PVCs for OSD on PVC test is prepared before running the integration test.
In addition, users are forced to run this script for this by themselves.
To avoid this problem, running this script inside the integration test.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
This commit is contained in:
Satoru Takeuchi committed 2020-05-14 05:14:27 +09:00
1 parent abdac2b412
commit e96009c26d
4 files changed
+17 -7

No files matched your search

Vendored
+1 -2
View File
@@ -198,8 +198,7 @@ def RunIntegrationTest(k, v) {
sh "tests/scripts/kubeadm.sh up"
sh '''#!/bin/bash
export KUBECONFIG=$HOME/admin.conf
tests/scripts/helm.sh up
tests/scripts/localPathPV.sh /dev/xvdc'''
tests/scripts/helm.sh up'''
try{
echo "Running full regression"
sh '''#!/bin/bash
+1 -5
View File
@@ -802,10 +802,6 @@ 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:
@@ -869,7 +865,7 @@ spec:
done
# Wipe the specific disk in the CI that was running in raw mode
set +Ee
block=` + scratchDevice + `
block=` + TestScratchDevice() + `
wipefs --all "$block"
dd if=/dev/zero of="$block" bs=1M count=100 oflag=direct,dsync
set -Ee
+5
View File
@@ -55,6 +55,11 @@ func baseTestDir() string {
return val
}
// TestScratchDevice get the scratch device to be used for OSD
func TestScratchDevice() string {
return getEnvVarWithDefault("TEST_SCRATCH_DEVICE", "/dev/xvdc")
}
func getEnvVarWithDefault(env, defaultValue string) string {
val := os.Getenv(env)
if val == "" {
@@ -29,6 +29,10 @@ import (
"github.com/stretchr/testify/suite"
)
const (
localPathPVCmd = "tests/scripts/localPathPV.sh"
)
// *************************************************************
// *** Major scenarios tested by the MultiClusterDeploySuite ***
// Setup
@@ -150,6 +154,12 @@ func NewMCTestOperations(t func() *testing.T, namespace1 string, namespace2 stri
// SetUpRook is wrapper for setting up multiple rook clusters.
func (o MCTestOperations) Setup() {
var err error
if o.testOverPVC {
cmdArgs := utils.CommandArgs{Command: localPathPVCmd, CmdArgs: []string{installer.TestScratchDevice()}}
cmdOut := utils.ExecuteCommand(cmdArgs)
require.NoError(o.T(), cmdOut.Err)
}
err = o.installer.CreateCephOperator(installer.SystemNamespace(o.namespace1))
require.NoError(o.T(), err)