2019-05-31 09:34:04 +00:00
|
|
|
package e2e
|
|
|
|
|
|
|
|
import (
|
2019-06-18 07:07:11 +00:00
|
|
|
"fmt"
|
2020-06-16 10:56:14 +00:00
|
|
|
"strings"
|
2019-06-14 09:42:48 +00:00
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
. "github.com/onsi/ginkgo" // nolint
|
2020-06-16 11:06:15 +00:00
|
|
|
v1 "k8s.io/api/core/v1"
|
2020-06-16 10:56:14 +00:00
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
2019-07-25 06:49:44 +00:00
|
|
|
clientset "k8s.io/client-go/kubernetes"
|
2019-05-31 09:34:04 +00:00
|
|
|
"k8s.io/kubernetes/test/e2e/framework"
|
2019-06-24 07:58:39 +00:00
|
|
|
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
2019-05-31 09:34:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
cephfsProvisioner = "csi-cephfsplugin-provisioner.yaml"
|
|
|
|
cephfsProvisionerRBAC = "csi-provisioner-rbac.yaml"
|
2020-01-21 08:22:43 +00:00
|
|
|
cephfsProvisionerPSP = "csi-provisioner-psp.yaml"
|
2019-05-31 09:34:04 +00:00
|
|
|
cephfsNodePlugin = "csi-cephfsplugin.yaml"
|
|
|
|
cephfsNodePluginRBAC = "csi-nodeplugin-rbac.yaml"
|
2020-01-21 08:22:43 +00:00
|
|
|
cephfsNodePluginPSP = "csi-nodeplugin-psp.yaml"
|
2019-06-10 08:00:40 +00:00
|
|
|
cephfsDeploymentName = "csi-cephfsplugin-provisioner"
|
|
|
|
cephfsDeamonSetName = "csi-cephfsplugin"
|
2019-12-19 15:35:58 +00:00
|
|
|
cephfsDirPath = "../deploy/cephfs/kubernetes/"
|
2019-06-10 08:00:40 +00:00
|
|
|
cephfsExamplePath = "../examples/cephfs/"
|
2019-05-31 09:34:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func deployCephfsPlugin() {
|
2019-12-11 08:48:36 +00:00
|
|
|
// delete objects deployed by rook
|
2020-02-26 08:11:05 +00:00
|
|
|
|
|
|
|
data, err := replaceNamespaceInTemplate(cephfsDirPath + cephfsProvisionerRBAC)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsProvisionerRBAC, err)
|
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, "--ignore-not-found=true", ns, "delete", "-f", "-")
|
2020-02-26 08:11:05 +00:00
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to delete provisioner rbac %s %v", cephfsDirPath+cephfsProvisionerRBAC, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
data, err = replaceNamespaceInTemplate(cephfsDirPath + cephfsNodePluginRBAC)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsNodePluginRBAC, err)
|
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, "delete", "--ignore-not-found=true", ns, "-f", "-")
|
2020-02-26 08:11:05 +00:00
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to delete nodeplugin rbac %s %v", cephfsDirPath+cephfsNodePluginRBAC, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
createORDeleteCephfsResouces("create")
|
2019-05-31 09:34:04 +00:00
|
|
|
}
|
|
|
|
|
2019-08-07 14:53:39 +00:00
|
|
|
func deleteCephfsPlugin() {
|
2020-02-26 08:11:05 +00:00
|
|
|
createORDeleteCephfsResouces("delete")
|
|
|
|
}
|
|
|
|
|
|
|
|
func createORDeleteCephfsResouces(action string) {
|
|
|
|
data, err := replaceNamespaceInTemplate(cephfsDirPath + cephfsProvisioner)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsProvisioner, err)
|
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, action, ns, "-f", "-")
|
2020-02-26 08:11:05 +00:00
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to %s cephfs provisioner %v", action, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
data, err = replaceNamespaceInTemplate(cephfsDirPath + cephfsProvisionerRBAC)
|
2019-08-07 14:53:39 +00:00
|
|
|
if err != nil {
|
2020-02-26 08:11:05 +00:00
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsProvisionerRBAC, err)
|
2019-08-07 14:53:39 +00:00
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, action, ns, "-f", "-")
|
2019-08-07 14:53:39 +00:00
|
|
|
if err != nil {
|
2020-02-26 08:11:05 +00:00
|
|
|
e2elog.Logf("failed to %s cephfs provisioner rbac %v", action, err)
|
2019-08-07 14:53:39 +00:00
|
|
|
}
|
2020-02-26 08:11:05 +00:00
|
|
|
|
|
|
|
data, err = replaceNamespaceInTemplate(cephfsDirPath + cephfsProvisionerPSP)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsProvisionerPSP, err)
|
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, action, ns, "-f", "-")
|
2020-02-26 08:11:05 +00:00
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to %s cephfs provisioner psp %v", action, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
data, err = replaceNamespaceInTemplate(cephfsDirPath + cephfsNodePlugin)
|
2020-01-21 08:22:43 +00:00
|
|
|
if err != nil {
|
2020-02-26 08:11:05 +00:00
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsNodePlugin, err)
|
2020-01-21 08:22:43 +00:00
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, action, ns, "-f", "-")
|
2019-08-07 14:53:39 +00:00
|
|
|
if err != nil {
|
2020-02-26 08:11:05 +00:00
|
|
|
e2elog.Logf("failed to %s cephfs nodeplugin %v", action, err)
|
2019-08-07 14:53:39 +00:00
|
|
|
}
|
2020-02-26 08:11:05 +00:00
|
|
|
|
|
|
|
data, err = replaceNamespaceInTemplate(cephfsDirPath + cephfsNodePluginRBAC)
|
2019-08-07 14:53:39 +00:00
|
|
|
if err != nil {
|
2020-02-26 08:11:05 +00:00
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsNodePluginRBAC, err)
|
2019-08-07 14:53:39 +00:00
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, action, ns, "-f", "-")
|
2020-02-26 08:11:05 +00:00
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to %s cephfs nodeplugin rbac %v", action, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
data, err = replaceNamespaceInTemplate(cephfsDirPath + cephfsNodePluginPSP)
|
2020-01-21 08:22:43 +00:00
|
|
|
if err != nil {
|
2020-02-26 08:11:05 +00:00
|
|
|
e2elog.Logf("failed to read content from %s %v", cephfsDirPath+cephfsNodePluginPSP, err)
|
|
|
|
}
|
2020-04-14 06:59:04 +00:00
|
|
|
_, err = framework.RunKubectlInput(cephCSINamespace, data, action, ns, "-f", "-")
|
2020-02-26 08:11:05 +00:00
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to %s cephfs nodeplugin psp %v", action, err)
|
2020-01-21 08:22:43 +00:00
|
|
|
}
|
2019-08-07 14:53:39 +00:00
|
|
|
}
|
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
var _ = Describe("cephfs", func() {
|
|
|
|
f := framework.NewDefaultFramework("cephfs")
|
2019-12-18 08:41:20 +00:00
|
|
|
var c clientset.Interface
|
2019-06-10 06:48:41 +00:00
|
|
|
// deploy cephfs CSI
|
2019-05-31 09:34:04 +00:00
|
|
|
BeforeEach(func() {
|
2019-12-18 08:41:20 +00:00
|
|
|
c = f.ClientSet
|
2020-02-25 08:00:23 +00:00
|
|
|
if deployCephFS {
|
2020-02-25 11:45:54 +00:00
|
|
|
if cephCSINamespace != defaultNs {
|
2020-02-26 08:11:05 +00:00
|
|
|
err := createNamespace(c, cephCSINamespace)
|
|
|
|
if err != nil {
|
2020-02-25 11:45:54 +00:00
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
}
|
2020-02-25 08:00:23 +00:00
|
|
|
deployCephfsPlugin()
|
|
|
|
}
|
2020-02-26 08:11:05 +00:00
|
|
|
createConfigMap(cephfsDirPath, f.ClientSet, f)
|
2019-05-31 09:34:04 +00:00
|
|
|
createCephfsSecret(f.ClientSet, f)
|
|
|
|
})
|
|
|
|
|
|
|
|
AfterEach(func() {
|
2019-12-18 08:41:20 +00:00
|
|
|
if CurrentGinkgoTestDescription().Failed {
|
2020-04-01 07:20:43 +00:00
|
|
|
// log pods created by helm chart
|
|
|
|
logsCSIPods("app=ceph-csi-cephfs", c)
|
2019-12-18 08:41:20 +00:00
|
|
|
// log provisoner
|
|
|
|
logsCSIPods("app=csi-cephfsplugin-provisioner", c)
|
|
|
|
// log node plugin
|
|
|
|
logsCSIPods("app=csi-cephfsplugin", c)
|
|
|
|
}
|
2019-12-04 01:35:02 +00:00
|
|
|
deleteConfigMap(cephfsDirPath)
|
2019-06-14 09:26:17 +00:00
|
|
|
deleteResource(cephfsExamplePath + "secret.yaml")
|
|
|
|
deleteResource(cephfsExamplePath + "storageclass.yaml")
|
2020-02-25 11:45:54 +00:00
|
|
|
if deployCephFS {
|
|
|
|
deleteCephfsPlugin()
|
|
|
|
if cephCSINamespace != defaultNs {
|
2020-02-26 08:11:05 +00:00
|
|
|
err := deleteNamespace(c, cephCSINamespace)
|
2020-02-25 11:45:54 +00:00
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-31 09:34:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
Context("Test cephfs CSI", func() {
|
|
|
|
It("Test cephfs CSI", func() {
|
2019-06-18 07:07:11 +00:00
|
|
|
pvcPath := cephfsExamplePath + "pvc.yaml"
|
|
|
|
appPath := cephfsExamplePath + "pod.yaml"
|
2019-07-25 06:49:44 +00:00
|
|
|
|
2019-12-19 15:35:58 +00:00
|
|
|
By("checking provisioner deployment is running")
|
2019-07-25 06:49:44 +00:00
|
|
|
var err error
|
2020-02-25 11:45:54 +00:00
|
|
|
err = waitForDeploymentComplete(cephfsDeploymentName, cephCSINamespace, f.ClientSet, deployTimeout)
|
2019-05-31 09:34:04 +00:00
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
By("checking nodeplugin deamonsets is running")
|
2020-02-25 11:45:54 +00:00
|
|
|
err = waitForDaemonSets(cephfsDeamonSetName, cephCSINamespace, f.ClientSet, deployTimeout)
|
2019-05-31 09:34:04 +00:00
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
2020-05-14 01:48:09 +00:00
|
|
|
By("check static PVC", func() {
|
|
|
|
scPath := cephfsExamplePath + "secret.yaml"
|
|
|
|
err := validateCephFsStaticPV(f, appPath, scPath)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-08-05 15:40:48 +00:00
|
|
|
By("create a storage class with pool and a PVC then Bind it to an app", func() {
|
2020-06-25 13:48:48 +00:00
|
|
|
createCephfsStorageClass(f.ClientSet, f, true, "")
|
2019-08-05 15:40:48 +00:00
|
|
|
validatePVCAndAppBinding(pvcPath, appPath, f)
|
|
|
|
deleteResource(cephfsExamplePath + "storageclass.yaml")
|
|
|
|
})
|
|
|
|
|
2020-06-25 13:48:48 +00:00
|
|
|
createCephfsStorageClass(f.ClientSet, f, false, "")
|
2019-08-05 15:40:48 +00:00
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
By("create and delete a PVC", func() {
|
|
|
|
By("create a PVC and Bind it to an app", func() {
|
|
|
|
validatePVCAndAppBinding(pvcPath, appPath, f)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2019-06-11 12:40:31 +00:00
|
|
|
By("create a PVC and Bind it to an app with normal user", func() {
|
|
|
|
validateNormalUserPVCAccess(pvcPath, f)
|
|
|
|
})
|
2019-06-18 07:07:11 +00:00
|
|
|
|
|
|
|
By("create/delete multiple PVCs and Apps", func() {
|
|
|
|
totalCount := 2
|
|
|
|
pvc, err := loadPVC(pvcPath)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
pvc.Namespace = f.UniqueName
|
|
|
|
|
|
|
|
app, err := loadApp(appPath)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
app.Namespace = f.UniqueName
|
|
|
|
// create pvc and app
|
|
|
|
for i := 0; i < totalCount; i++ {
|
|
|
|
name := fmt.Sprintf("%s%d", f.UniqueName, i)
|
2020-03-27 18:21:18 +00:00
|
|
|
err := createPVCAndApp(name, f, pvc, app, deployTimeout)
|
2019-06-18 07:07:11 +00:00
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// TODO add cephfs backend validation
|
|
|
|
|
|
|
|
// delete pvc and app
|
|
|
|
for i := 0; i < totalCount; i++ {
|
|
|
|
name := fmt.Sprintf("%s%d", f.UniqueName, i)
|
|
|
|
err := deletePVCAndApp(name, f, pvc, app)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-07-03 10:02:36 +00:00
|
|
|
By("check data persist after recreating pod with same pvc", func() {
|
|
|
|
err := checkDataPersist(pvcPath, appPath, f)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
})
|
2020-01-23 01:47:02 +00:00
|
|
|
|
|
|
|
By("creating a PVC, deleting backing subvolume, and checking successful PV deletion", func() {
|
|
|
|
pvc, err := loadPVC(pvcPath)
|
|
|
|
if pvc == nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
pvc.Namespace = f.UniqueName
|
|
|
|
|
|
|
|
err = createPVCAndvalidatePV(f.ClientSet, pvc, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
err = deleteBackingCephFSVolume(f, pvc)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
err = deletePVCAndValidatePV(f.ClientSet, pvc, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2020-06-25 13:48:48 +00:00
|
|
|
By("validate multiple subvolumegroup creation", func() {
|
|
|
|
deleteResource(cephfsExamplePath + "storageclass.yaml")
|
|
|
|
// re-define configmap with information of multiple clusters.
|
|
|
|
subvolgrpInfo := map[string]string{
|
|
|
|
"clusterID-1": "subvolgrp1",
|
|
|
|
"clusterID-2": "subvolgrp2",
|
|
|
|
}
|
|
|
|
createCustomConfigMap(f.ClientSet, cephfsDirPath, subvolgrpInfo)
|
|
|
|
createCephfsStorageClass(f.ClientSet, f, false, "clusterID-1")
|
|
|
|
validatePVCAndAppBinding(pvcPath, appPath, f)
|
|
|
|
deleteResource(cephfsExamplePath + "storageclass.yaml")
|
|
|
|
// verify subvolumegroup creation.
|
|
|
|
err := validateSubvolumegroup(f, "subvolgrp1")
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
// create resources and verify subvolume group creation
|
|
|
|
// for the second cluster.
|
|
|
|
createCephfsStorageClass(f.ClientSet, f, false, "clusterID-2")
|
|
|
|
validatePVCAndAppBinding(pvcPath, appPath, f)
|
|
|
|
deleteResource(cephfsExamplePath + "storageclass.yaml")
|
|
|
|
err = validateSubvolumegroup(f, "subvolgrp2")
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
deleteConfigMap(cephfsDirPath)
|
|
|
|
})
|
|
|
|
|
|
|
|
createConfigMap(cephfsDirPath, f.ClientSet, f)
|
|
|
|
createCephfsStorageClass(f.ClientSet, f, false, "")
|
|
|
|
|
2019-11-25 11:09:24 +00:00
|
|
|
By("Resize PVC and check application directory size", func() {
|
|
|
|
v, err := f.ClientSet.Discovery().ServerVersion()
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to get server version with error %v", err)
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
// Resize 0.3.0 is only supported from v1.15+
|
|
|
|
if v.Major > "1" || (v.Major == "1" && v.Minor >= "15") {
|
|
|
|
err := resizePVCAndValidateSize(pvcPath, appPath, f)
|
|
|
|
if err != nil {
|
|
|
|
e2elog.Logf("failed to resize PVC %v", err)
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
2019-07-03 10:02:36 +00:00
|
|
|
|
2020-06-16 10:56:14 +00:00
|
|
|
By("Mount pvc as readonly in pod", func() {
|
|
|
|
// create pvc and bind it to an app
|
|
|
|
pvc, err := loadPVC(pvcPath)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
pvc.Namespace = f.UniqueName
|
|
|
|
|
|
|
|
app, err := loadApp(appPath)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
app.Namespace = f.UniqueName
|
|
|
|
label := map[string]string{
|
|
|
|
"app": app.Name,
|
|
|
|
}
|
|
|
|
app.Labels = label
|
|
|
|
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvc.Name
|
|
|
|
app.Spec.Volumes[0].PersistentVolumeClaim.ReadOnly = true
|
|
|
|
err = createPVCAndApp("", f, pvc, app, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
opt := metav1.ListOptions{
|
|
|
|
LabelSelector: fmt.Sprintf("app=%s", app.Name),
|
|
|
|
}
|
|
|
|
|
|
|
|
filePath := app.Spec.Containers[0].VolumeMounts[0].MountPath + "/test"
|
|
|
|
_, stdErr := execCommandInPodAndAllowFail(f, fmt.Sprintf("echo 'Hello World' > %s", filePath), app.Namespace, &opt)
|
|
|
|
readOnlyErr := fmt.Sprintf("cannot create %s: Read-only file system", filePath)
|
|
|
|
if !strings.Contains(stdErr, readOnlyErr) {
|
|
|
|
Fail(stdErr)
|
|
|
|
}
|
|
|
|
|
|
|
|
// delete pvc and app
|
|
|
|
err = deletePVCAndApp("", f, pvc, app)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
})
|
2020-06-16 11:06:15 +00:00
|
|
|
|
|
|
|
By("Create ROX PVC and Bind it to an app", func() {
|
|
|
|
// create pvc and bind it to an app
|
|
|
|
pvc, err := loadPVC(pvcPath)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
pvc.Namespace = f.UniqueName
|
|
|
|
pvc.Spec.AccessModes = []v1.PersistentVolumeAccessMode{v1.ReadOnlyMany}
|
|
|
|
app, err := loadApp(appPath)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
app.Namespace = f.UniqueName
|
|
|
|
label := map[string]string{
|
|
|
|
"app": app.Name,
|
|
|
|
}
|
|
|
|
app.Labels = label
|
|
|
|
app.Spec.Volumes[0].PersistentVolumeClaim.ClaimName = pvc.Name
|
|
|
|
err = createPVCAndApp("", f, pvc, app, deployTimeout)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
opt := metav1.ListOptions{
|
|
|
|
LabelSelector: fmt.Sprintf("app=%s", app.Name),
|
|
|
|
}
|
|
|
|
|
|
|
|
filePath := app.Spec.Containers[0].VolumeMounts[0].MountPath + "/test"
|
|
|
|
_, stdErr := execCommandInPodAndAllowFail(f, fmt.Sprintf("echo 'Hello World' > %s", filePath), app.Namespace, &opt)
|
|
|
|
readOnlyErr := fmt.Sprintf("cannot create %s: Read-only file system", filePath)
|
|
|
|
if !strings.Contains(stdErr, readOnlyErr) {
|
|
|
|
Fail(stdErr)
|
|
|
|
}
|
|
|
|
|
|
|
|
// delete pvc and app
|
|
|
|
err = deletePVCAndApp("", f, pvc, app)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
})
|
2020-01-31 08:49:11 +00:00
|
|
|
// Make sure this should be last testcase in this file, because
|
|
|
|
// it deletes pool
|
|
|
|
By("Create a PVC and Delete PVC when backend pool deleted", func() {
|
|
|
|
err := pvcDeleteWhenPoolNotFound(pvcPath, true, f)
|
|
|
|
if err != nil {
|
|
|
|
Fail(err.Error())
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
})
|
2019-06-14 09:26:17 +00:00
|
|
|
|
2019-05-31 09:34:04 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|