Commit 1058877f authored by danielqsj's avatar danielqsj

remove dot imports in e2e/storage

parent 8a6fede9
......@@ -26,8 +26,8 @@ import (
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"k8s.io/kubernetes/test/e2e/storage/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/util/rand"
)
......@@ -55,52 +55,52 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
for _, initDriver := range csiTestDrivers {
curDriver := initDriver()
Context(testsuites.GetDriverNameWithFeatureTags(curDriver), func() {
ginkgo.Context(testsuites.GetDriverNameWithFeatureTags(curDriver), func() {
testsuites.DefineTestSuite(curDriver, csiTestSuites)
})
}
// TODO: PD CSI driver needs to be serial because it uses a fixed name. Address as part of #71289
Context("CSI Topology test using GCE PD driver [Serial]", func() {
ginkgo.Context("CSI Topology test using GCE PD driver [Serial]", func() {
f := framework.NewDefaultFramework("csitopology")
driver := drivers.InitGcePDCSIDriver().(testsuites.DynamicPVTestDriver) // TODO (#71289) eliminate by moving this test to common test suite.
var (
config *testsuites.PerTestConfig
testCleanup func()
)
BeforeEach(func() {
ginkgo.BeforeEach(func() {
driver.SkipUnsupportedTest(testpatterns.TestPattern{})
config, testCleanup = driver.PrepareTest(f)
})
AfterEach(func() {
ginkgo.AfterEach(func() {
if testCleanup != nil {
testCleanup()
}
})
It("should provision zonal PD with immediate volume binding and AllowedTopologies set and mount the volume to a pod", func() {
ginkgo.It("should provision zonal PD with immediate volume binding and AllowedTopologies set and mount the volume to a pod", func() {
suffix := "topology-positive"
testTopologyPositive(config.Framework.ClientSet, suffix, config.Framework.Namespace.GetName(), false /* delayBinding */, true /* allowedTopologies */)
})
It("should provision zonal PD with delayed volume binding and mount the volume to a pod", func() {
ginkgo.It("should provision zonal PD with delayed volume binding and mount the volume to a pod", func() {
suffix := "delayed"
testTopologyPositive(config.Framework.ClientSet, suffix, config.Framework.Namespace.GetName(), true /* delayBinding */, false /* allowedTopologies */)
})
It("should provision zonal PD with delayed volume binding and AllowedTopologies set and mount the volume to a pod", func() {
ginkgo.It("should provision zonal PD with delayed volume binding and AllowedTopologies set and mount the volume to a pod", func() {
suffix := "delayed-topology-positive"
testTopologyPositive(config.Framework.ClientSet, suffix, config.Framework.Namespace.GetName(), true /* delayBinding */, true /* allowedTopologies */)
})
It("should fail to schedule a pod with a zone missing from AllowedTopologies; PD is provisioned with immediate volume binding", func() {
ginkgo.It("should fail to schedule a pod with a zone missing from AllowedTopologies; PD is provisioned with immediate volume binding", func() {
framework.SkipUnlessMultizone(config.Framework.ClientSet)
suffix := "topology-negative"
testTopologyNegative(config.Framework.ClientSet, suffix, config.Framework.Namespace.GetName(), false /* delayBinding */)
})
It("should fail to schedule a pod with a zone missing from AllowedTopologies; PD is provisioned with delayed volume binding", func() {
ginkgo.It("should fail to schedule a pod with a zone missing from AllowedTopologies; PD is provisioned with delayed volume binding", func() {
framework.SkipUnlessMultizone(config.Framework.ClientSet)
suffix := "delayed-topology-negative"
testTopologyNegative(config.Framework.ClientSet, suffix, config.Framework.Namespace.GetName(), true /* delayBinding */)
......@@ -124,7 +124,7 @@ func testTopologyPositive(cs clientset.Interface, suffix, namespace string, dela
if delayBinding {
_, node := test.TestBindingWaitForFirstConsumer(nil /* node selector */, false /* expect unschedulable */)
Expect(node).ToNot(BeNil(), "Unexpected nil node found")
gomega.Expect(node).ToNot(gomega.BeNil(), "Unexpected nil node found")
} else {
test.TestDynamicProvisioning()
}
......@@ -136,7 +136,7 @@ func testTopologyNegative(cs clientset.Interface, suffix, namespace string, dela
// Use different zones for pod and PV
zones, err := framework.GetClusterZones(cs)
framework.ExpectNoError(err)
Expect(zones.Len()).To(BeNumerically(">=", 2))
gomega.Expect(zones.Len()).To(gomega.BeNumerically(">=", 2))
zonesList := zones.UnsortedList()
podZoneIndex := rand.Intn(zones.Len())
podZone := zonesList[podZoneIndex]
......
......@@ -31,7 +31,7 @@ import (
"k8s.io/kubernetes/test/e2e/storage/utils"
imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
)
var (
......@@ -49,7 +49,7 @@ var _ = utils.SIGDescribe("Detaching volumes", func() {
var node v1.Node
var suffix string
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("gce", "local")
framework.SkipUnlessMasterOSDistroIs("debian", "ubuntu", "gci", "custom")
framework.SkipUnlessNodeOSDistroIs("debian", "ubuntu", "gci", "custom")
......@@ -62,13 +62,13 @@ var _ = utils.SIGDescribe("Detaching volumes", func() {
suffix = ns.Name
})
It("should not work when mount is in progress [Slow]", func() {
ginkgo.It("should not work when mount is in progress [Slow]", func() {
driver := "attachable-with-long-mount"
driverInstallAs := driver + "-" + suffix
By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driverInstallAs))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driverInstallAs))
installFlex(cs, &node, "k8s", driverInstallAs, path.Join(driverDir, driver))
By(fmt.Sprintf("installing flexvolume %s on master as %s", path.Join(driverDir, driver), driverInstallAs))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on master as %s", path.Join(driverDir, driver), driverInstallAs))
installFlex(cs, nil, "k8s", driverInstallAs, path.Join(driverDir, driver))
volumeSource := v1.VolumeSource{
FlexVolume: &v1.FlexVolumeSource{
......@@ -77,31 +77,31 @@ var _ = utils.SIGDescribe("Detaching volumes", func() {
}
clientPod := getFlexVolumePod(volumeSource, node.Name)
By("Creating pod that uses slow format volume")
ginkgo.By("Creating pod that uses slow format volume")
pod, err := cs.CoreV1().Pods(ns.Name).Create(clientPod)
framework.ExpectNoError(err)
uniqueVolumeName := getUniqueVolumeName(pod, driverInstallAs)
By("waiting for volumes to be attached to node")
ginkgo.By("waiting for volumes to be attached to node")
err = waitForVolumesAttached(cs, node.Name, uniqueVolumeName)
framework.ExpectNoError(err, "while waiting for volume to attach to %s node", node.Name)
By("waiting for volume-in-use on the node after pod creation")
ginkgo.By("waiting for volume-in-use on the node after pod creation")
err = waitForVolumesInUse(cs, node.Name, uniqueVolumeName)
framework.ExpectNoError(err, "while waiting for volume in use")
By("waiting for kubelet to start mounting the volume")
ginkgo.By("waiting for kubelet to start mounting the volume")
time.Sleep(20 * time.Second)
By("Deleting the flexvolume pod")
ginkgo.By("Deleting the flexvolume pod")
err = framework.DeletePodWithWait(f, cs, pod)
framework.ExpectNoError(err, "in deleting the pod")
// Wait a bit for node to sync the volume status
time.Sleep(30 * time.Second)
By("waiting for volume-in-use on the node after pod deletion")
ginkgo.By("waiting for volume-in-use on the node after pod deletion")
err = waitForVolumesInUse(cs, node.Name, uniqueVolumeName)
framework.ExpectNoError(err, "while waiting for volume in use")
......@@ -109,13 +109,13 @@ var _ = utils.SIGDescribe("Detaching volumes", func() {
// we previously already waited for 30s.
time.Sleep(durationForStuckMount)
By("waiting for volume to disappear from node in-use")
ginkgo.By("waiting for volume to disappear from node in-use")
err = waitForVolumesNotInUse(cs, node.Name, uniqueVolumeName)
framework.ExpectNoError(err, "while waiting for volume to be removed from in-use")
By(fmt.Sprintf("uninstalling flexvolume %s from node %s", driverInstallAs, node.Name))
ginkgo.By(fmt.Sprintf("uninstalling flexvolume %s from node %s", driverInstallAs, node.Name))
uninstallFlex(cs, &node, "k8s", driverInstallAs)
By(fmt.Sprintf("uninstalling flexvolume %s from master", driverInstallAs))
ginkgo.By(fmt.Sprintf("uninstalling flexvolume %s from master", driverInstallAs))
uninstallFlex(cs, nil, "k8s", driverInstallAs)
})
})
......
......@@ -40,7 +40,7 @@ import (
"math/rand"
"strconv"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/sets"
......@@ -127,7 +127,7 @@ func (h *hostpathCSIDriver) GetClaimSize() string {
}
func (h *hostpathCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestConfig, func()) {
By(fmt.Sprintf("deploying %s driver", h.driverInfo.Name))
ginkgo.By(fmt.Sprintf("deploying %s driver", h.driverInfo.Name))
cancelLogging := testsuites.StartPodLogs(f)
cs := f.ClientSet
......@@ -161,7 +161,7 @@ func (h *hostpathCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.Per
}
return config, func() {
By(fmt.Sprintf("uninstalling %s driver", h.driverInfo.Name))
ginkgo.By(fmt.Sprintf("uninstalling %s driver", h.driverInfo.Name))
cleanup()
cancelLogging()
}
......@@ -258,7 +258,7 @@ func (m *mockCSIDriver) GetClaimSize() string {
}
func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestConfig, func()) {
By("deploying csi mock driver")
ginkgo.By("deploying csi mock driver")
cancelLogging := testsuites.StartPodLogs(f)
cs := f.ClientSet
......@@ -306,7 +306,7 @@ func (m *mockCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTest
}
return config, func() {
By("uninstalling csi mock driver")
ginkgo.By("uninstalling csi mock driver")
cleanup()
cancelLogging()
}
......@@ -391,7 +391,7 @@ func (g *gcePDCSIDriver) GetClaimSize() string {
}
func (g *gcePDCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTestConfig, func()) {
By("deploying csi gce-pd driver")
ginkgo.By("deploying csi gce-pd driver")
cancelLogging := testsuites.StartPodLogs(f)
// It would be safer to rename the gcePD driver, but that
// hasn't been done before either and attempts to do so now led to
......@@ -426,7 +426,7 @@ func (g *gcePDCSIDriver) PrepareTest(f *framework.Framework) (*testsuites.PerTes
Prefix: "gcepd",
Framework: f,
}, func() {
By("uninstalling gce-pd driver")
ginkgo.By("uninstalling gce-pd driver")
cleanup()
cancelLogging()
}
......
......@@ -29,8 +29,8 @@ import (
"k8s.io/kubernetes/test/e2e/storage/utils"
imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
)
const (
......@@ -144,15 +144,15 @@ var _ = utils.SIGDescribe("EmptyDir wrapper volumes", func() {
pod = f.PodClient().CreateSync(pod)
defer func() {
By("Cleaning up the secret")
ginkgo.By("Cleaning up the secret")
if err := f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Delete(secret.Name, nil); err != nil {
framework.Failf("unable to delete secret %v: %v", secret.Name, err)
}
By("Cleaning up the configmap")
ginkgo.By("Cleaning up the configmap")
if err := f.ClientSet.CoreV1().ConfigMaps(f.Namespace.Name).Delete(configMap.Name, nil); err != nil {
framework.Failf("unable to delete configmap %v: %v", configMap.Name, err)
}
By("Cleaning up the pod")
ginkgo.By("Cleaning up the pod")
if err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(pod.Name, metav1.NewDeleteOptions(0)); err != nil {
framework.Failf("unable to delete pod %v: %v", pod.Name, err)
}
......@@ -194,7 +194,7 @@ var _ = utils.SIGDescribe("EmptyDir wrapper volumes", func() {
// This test uses deprecated GitRepo VolumeSource so it MUST not be promoted to Conformance.
// To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod’s container.
// This projected volume maps approach can also be tested with secrets and downwardapi VolumeSource but are less prone to the race problem.
It("should not cause race condition when used for git_repo [Serial] [Slow]", func() {
ginkgo.It("should not cause race condition when used for git_repo [Serial] [Slow]", func() {
gitURL, gitRepo, cleanup := createGitServer(f)
defer cleanup()
volumes, volumeMounts := makeGitRepoVolumes(gitURL, gitRepo)
......@@ -255,11 +255,11 @@ func createGitServer(f *framework.Framework) (gitURL string, gitRepo string, cle
}
return "http://" + gitServerSvc.Spec.ClusterIP + ":" + strconv.Itoa(httpPort), "test", func() {
By("Cleaning up the git server pod")
ginkgo.By("Cleaning up the git server pod")
if err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(gitServerPod.Name, metav1.NewDeleteOptions(0)); err != nil {
framework.Failf("unable to delete git server pod %v: %v", gitServerPod.Name, err)
}
By("Cleaning up the git server svc")
ginkgo.By("Cleaning up the git server svc")
if err := f.ClientSet.CoreV1().Services(f.Namespace.Name).Delete(gitServerSvc.Name, nil); err != nil {
framework.Failf("unable to delete git server svc %v: %v", gitServerSvc.Name, err)
}
......@@ -287,7 +287,7 @@ func makeGitRepoVolumes(gitURL, gitRepo string) (volumes []v1.Volume, volumeMoun
}
func createConfigmapsForRace(f *framework.Framework) (configMapNames []string) {
By(fmt.Sprintf("Creating %d configmaps", wrappedVolumeRaceConfigMapVolumeCount))
ginkgo.By(fmt.Sprintf("Creating %d configmaps", wrappedVolumeRaceConfigMapVolumeCount))
for i := 0; i < wrappedVolumeRaceConfigMapVolumeCount; i++ {
configMapName := fmt.Sprintf("racey-configmap-%d", i)
configMapNames = append(configMapNames, configMapName)
......@@ -307,7 +307,7 @@ func createConfigmapsForRace(f *framework.Framework) (configMapNames []string) {
}
func deleteConfigMaps(f *framework.Framework, configMapNames []string) {
By("Cleaning up the configMaps")
ginkgo.By("Cleaning up the configMaps")
for _, configMapName := range configMapNames {
err := f.ClientSet.CoreV1().ConfigMaps(f.Namespace.Name).Delete(configMapName, nil)
framework.ExpectNoError(err, "unable to delete configMap %v", configMapName)
......@@ -346,10 +346,10 @@ func testNoWrappedVolumeRace(f *framework.Framework, volumes []v1.Volume, volume
rcName := wrappedVolumeRaceRCNamePrefix + string(uuid.NewUUID())
nodeList := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
Expect(len(nodeList.Items)).To(BeNumerically(">", 0))
gomega.Expect(len(nodeList.Items)).To(gomega.BeNumerically(">", 0))
targetNode := nodeList.Items[0]
By("Creating RC which spawns configmap-volume pods")
ginkgo.By("Creating RC which spawns configmap-volume pods")
affinity := &v1.Affinity{
NodeAffinity: &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
......@@ -412,7 +412,7 @@ func testNoWrappedVolumeRace(f *framework.Framework, volumes []v1.Volume, volume
pods, err := framework.PodsCreated(f.ClientSet, f.Namespace.Name, rcName, podCount)
By("Ensuring each pod is running")
ginkgo.By("Ensuring each pod is running")
// Wait for the pods to enter the running state. Waiting loops until the pods
// are running so non-running pods cause a timeout for this test.
......
......@@ -30,7 +30,7 @@ import (
"k8s.io/kubernetes/test/e2e/storage/utils"
imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
)
var (
......@@ -46,13 +46,13 @@ var _ = utils.SIGDescribe("Ephemeralstorage", func() {
f := framework.NewDefaultFramework("pv")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
c = f.ClientSet
})
Describe("When pod refers to non-existent ephemeral storage", func() {
ginkgo.Describe("When pod refers to non-existent ephemeral storage", func() {
for _, testSource := range invalidEphemeralSource("pod-ephm-test") {
It(fmt.Sprintf("should allow deletion of pod with invalid volume : %s", testSource.volumeType), func() {
ginkgo.It(fmt.Sprintf("should allow deletion of pod with invalid volume : %s", testSource.volumeType), func() {
pod := testEphemeralVolumePod(f, testSource.volumeType, testSource.source)
pod, err := c.CoreV1().Pods(f.Namespace.Name).Create(pod)
framework.ExpectNoError(err)
......
......@@ -24,7 +24,7 @@ import (
"time"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
v1 "k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
clientset "k8s.io/client-go/kubernetes"
......@@ -92,7 +92,7 @@ func installFlex(c clientset.Interface, node *v1.Node, vendor, driver, filePath
cmd := fmt.Sprintf("sudo mkdir -p %s", flexDir)
sshAndLog(cmd, host, true /*failOnError*/)
data := testfiles.ReadOrDie(filePath, Fail)
data := testfiles.ReadOrDie(filePath, ginkgo.Fail)
cmd = fmt.Sprintf("sudo tee <<'EOF' %s\n%s\nEOF", flexFile, string(data))
sshAndLog(cmd, host, true /*failOnError*/)
......@@ -164,7 +164,7 @@ var _ = utils.SIGDescribe("Flexvolumes", func() {
var config volume.TestConfig
var suffix string
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("gce", "local")
framework.SkipUnlessMasterOSDistroIs("debian", "ubuntu", "gci", "custom")
framework.SkipUnlessNodeOSDistroIs("debian", "ubuntu", "gci", "custom")
......@@ -182,36 +182,36 @@ var _ = utils.SIGDescribe("Flexvolumes", func() {
suffix = ns.Name
})
It("should be mountable when non-attachable", func() {
ginkgo.It("should be mountable when non-attachable", func() {
driver := "dummy"
driverInstallAs := driver + "-" + suffix
By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driverInstallAs))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driverInstallAs))
installFlex(cs, &node, "k8s", driverInstallAs, path.Join(driverDir, driver))
testFlexVolume(driverInstallAs, cs, config, f)
By("waiting for flex client pod to terminate")
ginkgo.By("waiting for flex client pod to terminate")
if err := f.WaitForPodTerminated(config.Prefix+"-client", ""); !apierrs.IsNotFound(err) {
framework.ExpectNoError(err, "Failed to wait client pod terminated: %v", err)
}
By(fmt.Sprintf("uninstalling flexvolume %s from node %s", driverInstallAs, node.Name))
ginkgo.By(fmt.Sprintf("uninstalling flexvolume %s from node %s", driverInstallAs, node.Name))
uninstallFlex(cs, &node, "k8s", driverInstallAs)
})
It("should be mountable when attachable", func() {
ginkgo.It("should be mountable when attachable", func() {
driver := "dummy-attachable"
driverInstallAs := driver + "-" + suffix
By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driverInstallAs))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driverInstallAs))
installFlex(cs, &node, "k8s", driverInstallAs, path.Join(driverDir, driver))
By(fmt.Sprintf("installing flexvolume %s on master as %s", path.Join(driverDir, driver), driverInstallAs))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on master as %s", path.Join(driverDir, driver), driverInstallAs))
installFlex(cs, nil, "k8s", driverInstallAs, path.Join(driverDir, driver))
testFlexVolume(driverInstallAs, cs, config, f)
By("waiting for flex client pod to terminate")
ginkgo.By("waiting for flex client pod to terminate")
if err := f.WaitForPodTerminated(config.Prefix+"-client", ""); !apierrs.IsNotFound(err) {
framework.ExpectNoError(err, "Failed to wait client pod terminated: %v", err)
}
......@@ -219,9 +219,9 @@ var _ = utils.SIGDescribe("Flexvolumes", func() {
// Detach might occur after pod deletion. Wait before deleting driver.
time.Sleep(detachTimeout)
By(fmt.Sprintf("uninstalling flexvolume %s from node %s", driverInstallAs, node.Name))
ginkgo.By(fmt.Sprintf("uninstalling flexvolume %s from node %s", driverInstallAs, node.Name))
uninstallFlex(cs, &node, "k8s", driverInstallAs)
By(fmt.Sprintf("uninstalling flexvolume %s from master", driverInstallAs))
ginkgo.By(fmt.Sprintf("uninstalling flexvolume %s from master", driverInstallAs))
uninstallFlex(cs, nil, "k8s", driverInstallAs)
})
})
......@@ -20,8 +20,8 @@ import (
"fmt"
"path"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/resource"
......@@ -50,7 +50,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
)
f := framework.NewDefaultFramework("mounted-flexvolume-expand")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("aws", "gce", "local")
framework.SkipUnlessMasterOSDistroIs("debian", "ubuntu", "gci", "custom")
framework.SkipUnlessNodeOSDistroIs("debian", "ubuntu", "gci", "custom")
......@@ -88,7 +88,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
fmt.Printf("storage class creation error: %v\n", err)
}
framework.ExpectNoError(err, "Error creating resizable storage class")
Expect(*resizableSc.AllowVolumeExpansion).To(BeTrue())
gomega.Expect(*resizableSc.AllowVolumeExpansion).To(gomega.BeTrue())
pvc = getClaim("2Gi", ns)
pvc.Spec.StorageClassName = &resizableSc.Name
......@@ -102,7 +102,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
}
})
AfterEach(func() {
ginkgo.AfterEach(func() {
e2elog.Logf("AfterEach: Cleaning up resources for mounted volume resize")
if c != nil {
......@@ -114,13 +114,13 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
}
})
It("Should verify mounted flex volumes can be resized", func() {
ginkgo.It("Should verify mounted flex volumes can be resized", func() {
driver := "dummy-attachable"
nodeList := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
node := nodeList.Items[0]
By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driver))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driver))
installFlex(c, &node, "k8s", driver, path.Join(driverDir, driver))
By(fmt.Sprintf("installing flexvolume %s on (master) node %s as %s", path.Join(driverDir, driver), node.Name, driver))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on (master) node %s as %s", path.Join(driverDir, driver), node.Name, driver))
installFlex(c, nil, "k8s", driver, path.Join(driverDir, driver))
pv := framework.MakePersistentVolume(framework.PersistentVolumeConfig{
......@@ -136,52 +136,52 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
pv, err = framework.CreatePV(c, pv)
framework.ExpectNoError(err, "Error creating pv %v", err)
By("Waiting for PVC to be in bound phase")
ginkgo.By("Waiting for PVC to be in bound phase")
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
var pvs []*v1.PersistentVolume
pvs, err = framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
Expect(len(pvs)).To(Equal(1))
gomega.Expect(len(pvs)).To(gomega.Equal(1))
By("Creating a deployment with the provisioned volume")
ginkgo.By("Creating a deployment with the provisioned volume")
deployment, err := e2edeploy.CreateDeployment(c, int32(1), map[string]string{"test": "app"}, nodeKeyValueLabel, ns, pvcClaims, "")
framework.ExpectNoError(err, "Failed creating deployment %v", err)
defer c.AppsV1().Deployments(ns).Delete(deployment.Name, &metav1.DeleteOptions{})
By("Expanding current pvc")
ginkgo.By("Expanding current pvc")
newSize := resource.MustParse("6Gi")
pvc, err = expandPVCSize(pvc, newSize, c)
framework.ExpectNoError(err, "While updating pvc for more size")
Expect(pvc).NotTo(BeNil())
gomega.Expect(pvc).NotTo(gomega.BeNil())
pvcSize := pvc.Spec.Resources.Requests[v1.ResourceStorage]
if pvcSize.Cmp(newSize) != 0 {
framework.Failf("error updating pvc size %q", pvc.Name)
}
By("Waiting for cloudprovider resize to finish")
ginkgo.By("Waiting for cloudprovider resize to finish")
err = waitForControllerVolumeResize(pvc, c, totalResizeWaitPeriod)
framework.ExpectNoError(err, "While waiting for pvc resize to finish")
By("Getting a pod from deployment")
ginkgo.By("Getting a pod from deployment")
podList, err := e2edeploy.GetPodsForDeployment(c, deployment)
Expect(podList.Items).NotTo(BeEmpty())
gomega.Expect(podList.Items).NotTo(gomega.BeEmpty())
pod := podList.Items[0]
By("Deleting the pod from deployment")
ginkgo.By("Deleting the pod from deployment")
err = framework.DeletePodWithWait(f, c, &pod)
framework.ExpectNoError(err, "while deleting pod for resizing")
By("Waiting for deployment to create new pod")
ginkgo.By("Waiting for deployment to create new pod")
pod, err = waitForDeploymentToRecreatePod(c, deployment)
framework.ExpectNoError(err, "While waiting for pod to be recreated")
By("Waiting for file system resize to finish")
ginkgo.By("Waiting for file system resize to finish")
pvc, err = waitForFSResize(pvc, c)
framework.ExpectNoError(err, "while waiting for fs resize to finish")
pvcConditions := pvc.Status.Conditions
Expect(len(pvcConditions)).To(Equal(0), "pvc should not have conditions")
gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions")
})
})
......@@ -20,8 +20,8 @@ import (
"fmt"
"path"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/resource"
......@@ -49,7 +49,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
)
f := framework.NewDefaultFramework("mounted-flexvolume-expand")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("aws", "gce", "local")
framework.SkipUnlessMasterOSDistroIs("debian", "ubuntu", "gci", "custom")
framework.SkipUnlessNodeOSDistroIs("debian", "ubuntu", "gci", "custom")
......@@ -86,7 +86,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
fmt.Printf("storage class creation error: %v\n", err)
}
framework.ExpectNoError(err, "Error creating resizable storage class: %v", err)
Expect(*resizableSc.AllowVolumeExpansion).To(BeTrue())
gomega.Expect(*resizableSc.AllowVolumeExpansion).To(gomega.BeTrue())
pvc = getClaim("2Gi", ns)
pvc.Spec.StorageClassName = &resizableSc.Name
......@@ -101,7 +101,7 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
}
})
AfterEach(func() {
ginkgo.AfterEach(func() {
e2elog.Logf("AfterEach: Cleaning up resources for mounted volume resize")
if c != nil {
......@@ -113,13 +113,13 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
}
})
It("should be resizable when mounted", func() {
ginkgo.It("should be resizable when mounted", func() {
driver := "dummy-attachable"
node := nodeList.Items[0]
By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driver))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on node %s as %s", path.Join(driverDir, driver), node.Name, driver))
installFlex(c, &node, "k8s", driver, path.Join(driverDir, driver))
By(fmt.Sprintf("installing flexvolume %s on (master) node %s as %s", path.Join(driverDir, driver), node.Name, driver))
ginkgo.By(fmt.Sprintf("installing flexvolume %s on (master) node %s as %s", path.Join(driverDir, driver), node.Name, driver))
installFlex(c, nil, "k8s", driver, path.Join(driverDir, driver))
pv := framework.MakePersistentVolume(framework.PersistentVolumeConfig{
......@@ -135,44 +135,44 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
pv, err = framework.CreatePV(c, pv)
framework.ExpectNoError(err, "Error creating pv %v", err)
By("Waiting for PVC to be in bound phase")
ginkgo.By("Waiting for PVC to be in bound phase")
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
var pvs []*v1.PersistentVolume
pvs, err = framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
Expect(len(pvs)).To(Equal(1))
gomega.Expect(len(pvs)).To(gomega.Equal(1))
var pod *v1.Pod
By("Creating pod")
ginkgo.By("Creating pod")
pod, err = framework.CreateNginxPod(c, ns, nodeKeyValueLabel, pvcClaims)
framework.ExpectNoError(err, "Failed to create pod %v", err)
defer framework.DeletePodWithWait(f, c, pod)
By("Waiting for pod to go to 'running' state")
ginkgo.By("Waiting for pod to go to 'running' state")
err = f.WaitForPodRunning(pod.ObjectMeta.Name)
framework.ExpectNoError(err, "Pod didn't go to 'running' state %v", err)
By("Expanding current pvc")
ginkgo.By("Expanding current pvc")
newSize := resource.MustParse("6Gi")
pvc, err = expandPVCSize(pvc, newSize, c)
framework.ExpectNoError(err, "While updating pvc for more size")
Expect(pvc).NotTo(BeNil())
gomega.Expect(pvc).NotTo(gomega.BeNil())
pvcSize := pvc.Spec.Resources.Requests[v1.ResourceStorage]
if pvcSize.Cmp(newSize) != 0 {
framework.Failf("error updating pvc size %q", pvc.Name)
}
By("Waiting for cloudprovider resize to finish")
ginkgo.By("Waiting for cloudprovider resize to finish")
err = waitForControllerVolumeResize(pvc, c, totalResizeWaitPeriod)
framework.ExpectNoError(err, "While waiting for pvc resize to finish")
By("Waiting for file system resize to finish")
ginkgo.By("Waiting for file system resize to finish")
pvc, err = waitForFSResize(pvc, c)
framework.ExpectNoError(err, "while waiting for fs resize to finish")
pvcConditions := pvc.Status.Conditions
Expect(len(pvcConditions)).To(Equal(0), "pvc should not have conditions")
gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions")
})
})
......@@ -17,8 +17,8 @@ limitations under the License.
package storage
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
......@@ -35,7 +35,7 @@ var _ = utils.SIGDescribe("GenericPersistentVolume[Disruptive]", func() {
ns string
)
BeforeEach(func() {
ginkgo.BeforeEach(func() {
// Skip tests unless number of nodes is 2
framework.SkipUnlessNodeCountIsAtLeast(2)
framework.SkipIfProviderIs("local")
......@@ -56,8 +56,8 @@ var _ = utils.SIGDescribe("GenericPersistentVolume[Disruptive]", func() {
runTest: utils.TestVolumeUnmountsFromForceDeletedPod,
},
}
Context("When kubelet restarts", func() {
// Test table housing the It() title string and test spec. runTest is type testBody, defined at
ginkgo.Context("When kubelet restarts", func() {
// Test table housing the ginkgo.It() title string and test spec. runTest is type testBody, defined at
// the start of this file. To add tests, define a function mirroring the testBody signature and assign
// to runTest.
var (
......@@ -65,19 +65,19 @@ var _ = utils.SIGDescribe("GenericPersistentVolume[Disruptive]", func() {
pvc *v1.PersistentVolumeClaim
pv *v1.PersistentVolume
)
BeforeEach(func() {
ginkgo.BeforeEach(func() {
e2elog.Logf("Initializing pod and pvcs for test")
clientPod, pvc, pv = createPodPVCFromSC(f, c, ns)
})
for _, test := range disruptiveTestTable {
func(t disruptiveTest) {
It(t.testItStmt, func() {
By("Executing Spec")
ginkgo.It(t.testItStmt, func() {
ginkgo.By("Executing Spec")
t.runTest(c, f, clientPod)
})
}(test)
}
AfterEach(func() {
ginkgo.AfterEach(func() {
e2elog.Logf("Tearing down test spec")
tearDownTestCase(c, f, ns, clientPod, pvc, pv, false)
pvc, clientPod = nil, nil
......@@ -97,9 +97,9 @@ func createPodPVCFromSC(f *framework.Framework, c clientset.Interface, ns string
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
Expect(len(pvs)).To(Equal(1))
gomega.Expect(len(pvs)).To(gomega.Equal(1))
By("Creating a pod with dynamically provisioned volume")
ginkgo.By("Creating a pod with dynamically provisioned volume")
pod, err := framework.CreateNginxPod(c, ns, nil, pvcClaims)
framework.ExpectNoError(err, "While creating pods for kubelet restart test")
return pod, pvc, pvs[0]
......
......@@ -17,7 +17,7 @@ limitations under the License.
package storage
import (
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
"k8s.io/kubernetes/test/e2e/storage/drivers"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"k8s.io/kubernetes/test/e2e/storage/utils"
......@@ -63,7 +63,7 @@ var _ = utils.SIGDescribe("In-tree Volumes", func() {
for _, initDriver := range testDrivers {
curDriver := initDriver()
Context(testsuites.GetDriverNameWithFeatureTags(curDriver), func() {
ginkgo.Context(testsuites.GetDriverNameWithFeatureTags(curDriver), func() {
testsuites.DefineTestSuite(curDriver, testSuites)
})
}
......
......@@ -19,8 +19,8 @@ package storage
import (
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
apps "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1"
......@@ -52,7 +52,7 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() {
)
f := framework.NewDefaultFramework("mounted-volume-expand")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("aws", "gce")
c = f.ClientSet
ns = f.Namespace.Name
......@@ -83,7 +83,7 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() {
}
resizableSc, err = createStorageClass(test, ns, "resizing", c)
framework.ExpectNoError(err, "Error creating resizable storage class")
Expect(*resizableSc.AllowVolumeExpansion).To(BeTrue())
gomega.Expect(*resizableSc.AllowVolumeExpansion).To(gomega.BeTrue())
pvc = newClaim(test, ns, "default")
pvc.Spec.StorageClassName = &resizableSc.Name
......@@ -97,7 +97,7 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() {
}
})
AfterEach(func() {
ginkgo.AfterEach(func() {
e2elog.Logf("AfterEach: Cleaning up resources for mounted volume resize")
if c != nil {
......@@ -109,57 +109,57 @@ var _ = utils.SIGDescribe("Mounted volume expand", func() {
}
})
It("Should verify mounted devices can be resized", func() {
ginkgo.It("Should verify mounted devices can be resized", func() {
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
// The reason we use a node selector is because we do not want pod to move to different node when pod is deleted.
// Keeping pod on same node reproduces the scenario that volume might already be mounted when resize is attempted.
// We should consider adding a unit test that exercises this better.
By("Creating a deployment with selected PVC")
ginkgo.By("Creating a deployment with selected PVC")
deployment, err := e2edeploy.CreateDeployment(c, int32(1), map[string]string{"test": "app"}, nodeKeyValueLabel, ns, pvcClaims, "")
framework.ExpectNoError(err, "Failed creating deployment %v", err)
defer c.AppsV1().Deployments(ns).Delete(deployment.Name, &metav1.DeleteOptions{})
// PVC should be bound at this point
By("Checking for bound PVC")
ginkgo.By("Checking for bound PVC")
pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
Expect(len(pvs)).To(Equal(1))
gomega.Expect(len(pvs)).To(gomega.Equal(1))
By("Expanding current pvc")
ginkgo.By("Expanding current pvc")
newSize := resource.MustParse("6Gi")
pvc, err = expandPVCSize(pvc, newSize, c)
framework.ExpectNoError(err, "While updating pvc for more size")
Expect(pvc).NotTo(BeNil())
gomega.Expect(pvc).NotTo(gomega.BeNil())
pvcSize := pvc.Spec.Resources.Requests[v1.ResourceStorage]
if pvcSize.Cmp(newSize) != 0 {
framework.Failf("error updating pvc size %q", pvc.Name)
}
By("Waiting for cloudprovider resize to finish")
ginkgo.By("Waiting for cloudprovider resize to finish")
err = waitForControllerVolumeResize(pvc, c, totalResizeWaitPeriod)
framework.ExpectNoError(err, "While waiting for pvc resize to finish")
By("Getting a pod from deployment")
ginkgo.By("Getting a pod from deployment")
podList, err := e2edeploy.GetPodsForDeployment(c, deployment)
Expect(podList.Items).NotTo(BeEmpty())
gomega.Expect(podList.Items).NotTo(gomega.BeEmpty())
pod := podList.Items[0]
By("Deleting the pod from deployment")
ginkgo.By("Deleting the pod from deployment")
err = framework.DeletePodWithWait(f, c, &pod)
framework.ExpectNoError(err, "while deleting pod for resizing")
By("Waiting for deployment to create new pod")
ginkgo.By("Waiting for deployment to create new pod")
pod, err = waitForDeploymentToRecreatePod(c, deployment)
framework.ExpectNoError(err, "While waiting for pod to be recreated")
By("Waiting for file system resize to finish")
ginkgo.By("Waiting for file system resize to finish")
pvc, err = waitForFSResize(pvc, c)
framework.ExpectNoError(err, "while waiting for fs resize to finish")
pvcConditions := pvc.Status.Conditions
Expect(len(pvcConditions)).To(Equal(0), "pvc should not have conditions")
gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions")
})
})
......
......@@ -20,8 +20,8 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
......@@ -58,7 +58,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
selector *metav1.LabelSelector
)
BeforeEach(func() {
ginkgo.BeforeEach(func() {
// To protect the NFS volume pod from the kubelet restart, we isolate it on its own node.
framework.SkipUnlessNodeCountIsAtLeast(MinNodes)
framework.SkipIfProviderIs("local")
......@@ -98,15 +98,15 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
break
}
}
Expect(clientNodeIP).NotTo(BeEmpty())
gomega.Expect(clientNodeIP).NotTo(gomega.BeEmpty())
}
})
AfterEach(func() {
ginkgo.AfterEach(func() {
framework.DeletePodWithWait(f, c, nfsServerPod)
})
Context("when kube-controller-manager restarts", func() {
ginkgo.Context("when kube-controller-manager restarts", func() {
var (
diskName1, diskName2 string
err error
......@@ -117,11 +117,11 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
clientPod *v1.Pod
)
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("gce")
framework.SkipUnlessSSHKeyPresent()
By("Initializing first PD with PVPVC binding")
ginkgo.By("Initializing first PD with PVPVC binding")
pvSource1, diskName1 = volume.CreateGCEVolume()
framework.ExpectNoError(err)
pvConfig1 = framework.PersistentVolumeConfig{
......@@ -134,7 +134,7 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
framework.ExpectNoError(err)
framework.ExpectNoError(framework.WaitOnPVandPVC(c, ns, pv1, pvc1))
By("Initializing second PD with PVPVC binding")
ginkgo.By("Initializing second PD with PVPVC binding")
pvSource2, diskName2 = volume.CreateGCEVolume()
framework.ExpectNoError(err)
pvConfig2 = framework.PersistentVolumeConfig{
......@@ -147,12 +147,12 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
framework.ExpectNoError(err)
framework.ExpectNoError(framework.WaitOnPVandPVC(c, ns, pv2, pvc2))
By("Attaching both PVC's to a single pod")
ginkgo.By("Attaching both PVC's to a single pod")
clientPod, err = framework.CreatePod(c, ns, nil, []*v1.PersistentVolumeClaim{pvc1, pvc2}, true, "")
framework.ExpectNoError(err)
})
AfterEach(func() {
ginkgo.AfterEach(func() {
// Delete client/user pod first
framework.ExpectNoError(framework.DeletePodWithWait(f, c, clientPod))
......@@ -175,20 +175,20 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
}
})
It("should delete a bound PVC from a clientPod, restart the kube-control-manager, and ensure the kube-controller-manager does not crash", func() {
By("Deleting PVC for volume 2")
ginkgo.It("should delete a bound PVC from a clientPod, restart the kube-control-manager, and ensure the kube-controller-manager does not crash", func() {
ginkgo.By("Deleting PVC for volume 2")
err = framework.DeletePersistentVolumeClaim(c, pvc2.Name, ns)
framework.ExpectNoError(err)
pvc2 = nil
By("Restarting the kube-controller-manager")
ginkgo.By("Restarting the kube-controller-manager")
err = framework.RestartControllerManager()
framework.ExpectNoError(err)
err = framework.WaitForControllerManagerUp()
framework.ExpectNoError(err)
e2elog.Logf("kube-controller-manager restarted")
By("Observing the kube-controller-manager healthy for at least 2 minutes")
ginkgo.By("Observing the kube-controller-manager healthy for at least 2 minutes")
// Continue checking for 2 minutes to make sure kube-controller-manager is healthy
err = framework.CheckForControllerManagerHealthy(2 * time.Minute)
framework.ExpectNoError(err)
......@@ -196,25 +196,25 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
})
Context("when kubelet restarts", func() {
ginkgo.Context("when kubelet restarts", func() {
var (
clientPod *v1.Pod
pv *v1.PersistentVolume
pvc *v1.PersistentVolumeClaim
)
BeforeEach(func() {
ginkgo.BeforeEach(func() {
e2elog.Logf("Initializing test spec")
clientPod, pv, pvc = initTestCase(f, c, nfsPVconfig, pvcConfig, ns, clientNode.Name)
})
AfterEach(func() {
ginkgo.AfterEach(func() {
e2elog.Logf("Tearing down test spec")
tearDownTestCase(c, f, ns, clientPod, pvc, pv, true /* force PV delete */)
pv, pvc, clientPod = nil, nil, nil
})
// Test table housing the It() title string and test spec. runTest is type testBody, defined at
// Test table housing the ginkgo.It() title string and test spec. runTest is type testBody, defined at
// the start of this file. To add tests, define a function mirroring the testBody signature and assign
// to runTest.
disruptiveTestTable := []disruptiveTest{
......@@ -235,8 +235,8 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
// Test loop executes each disruptiveTest iteratively.
for _, test := range disruptiveTestTable {
func(t disruptiveTest) {
It(t.testItStmt, func() {
By("Executing Spec")
ginkgo.It(t.testItStmt, func() {
ginkgo.By("Executing Spec")
t.runTest(c, f, clientPod)
})
}(test)
......
......@@ -17,8 +17,8 @@ limitations under the License.
package storage
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
......@@ -42,12 +42,12 @@ func verifyGCEDiskAttached(diskName string, nodeName types.NodeName) bool {
// initializeGCETestSpec creates a PV, PVC, and ClientPod that will run until killed by test or clean up.
func initializeGCETestSpec(c clientset.Interface, ns string, pvConfig framework.PersistentVolumeConfig, pvcConfig framework.PersistentVolumeClaimConfig, isPrebound bool) (*v1.Pod, *v1.PersistentVolume, *v1.PersistentVolumeClaim) {
By("Creating the PV and PVC")
ginkgo.By("Creating the PV and PVC")
pv, pvc, err := framework.CreatePVPVC(c, pvConfig, pvcConfig, ns, isPrebound)
framework.ExpectNoError(err)
framework.ExpectNoError(framework.WaitOnPVandPVC(c, ns, pv, pvc))
By("Creating the Client Pod")
ginkgo.By("Creating the Client Pod")
clientPod, err := framework.CreateClientPod(c, ns, pvc)
framework.ExpectNoError(err)
return clientPod, pv, pvc
......@@ -71,7 +71,7 @@ var _ = utils.SIGDescribe("PersistentVolumes GCEPD", func() {
)
f := framework.NewDefaultFramework("pv")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
c = f.ClientSet
ns = f.Namespace.Name
......@@ -80,7 +80,7 @@ var _ = utils.SIGDescribe("PersistentVolumes GCEPD", func() {
selector = metav1.SetAsLabelSelector(volLabel)
framework.SkipUnlessProviderIs("gce", "gke")
By("Initializing Test Spec")
ginkgo.By("Initializing Test Spec")
diskName, err = framework.CreatePDWithRetry()
framework.ExpectNoError(err)
pvConfig = framework.PersistentVolumeConfig{
......@@ -104,7 +104,7 @@ var _ = utils.SIGDescribe("PersistentVolumes GCEPD", func() {
node = types.NodeName(clientPod.Spec.NodeName)
})
AfterEach(func() {
ginkgo.AfterEach(func() {
e2elog.Logf("AfterEach: Cleaning up test resources")
if c != nil {
framework.ExpectNoError(framework.DeletePodWithWait(f, c, clientPod))
......@@ -120,45 +120,45 @@ var _ = utils.SIGDescribe("PersistentVolumes GCEPD", func() {
// Attach a persistent disk to a pod using a PVC.
// Delete the PVC and then the pod. Expect the pod to succeed in unmounting and detaching PD on delete.
It("should test that deleting a PVC before the pod does not cause pod deletion to fail on PD detach", func() {
ginkgo.It("should test that deleting a PVC before the pod does not cause pod deletion to fail on PD detach", func() {
By("Deleting the Claim")
ginkgo.By("Deleting the Claim")
framework.ExpectNoError(framework.DeletePersistentVolumeClaim(c, pvc.Name, ns), "Unable to delete PVC ", pvc.Name)
Expect(verifyGCEDiskAttached(diskName, node)).To(BeTrue())
gomega.Expect(verifyGCEDiskAttached(diskName, node)).To(gomega.BeTrue())
By("Deleting the Pod")
ginkgo.By("Deleting the Pod")
framework.ExpectNoError(framework.DeletePodWithWait(f, c, clientPod), "Failed to delete pod ", clientPod.Name)
By("Verifying Persistent Disk detach")
ginkgo.By("Verifying Persistent Disk detach")
framework.ExpectNoError(waitForPDDetach(diskName, node), "PD ", diskName, " did not detach")
})
// Attach a persistent disk to a pod using a PVC.
// Delete the PV and then the pod. Expect the pod to succeed in unmounting and detaching PD on delete.
It("should test that deleting the PV before the pod does not cause pod deletion to fail on PD detach", func() {
ginkgo.It("should test that deleting the PV before the pod does not cause pod deletion to fail on PD detach", func() {
By("Deleting the Persistent Volume")
ginkgo.By("Deleting the Persistent Volume")
framework.ExpectNoError(framework.DeletePersistentVolume(c, pv.Name), "Failed to delete PV ", pv.Name)
Expect(verifyGCEDiskAttached(diskName, node)).To(BeTrue())
gomega.Expect(verifyGCEDiskAttached(diskName, node)).To(gomega.BeTrue())
By("Deleting the client pod")
ginkgo.By("Deleting the client pod")
framework.ExpectNoError(framework.DeletePodWithWait(f, c, clientPod), "Failed to delete pod ", clientPod.Name)
By("Verifying Persistent Disk detaches")
ginkgo.By("Verifying Persistent Disk detaches")
framework.ExpectNoError(waitForPDDetach(diskName, node), "PD ", diskName, " did not detach")
})
// Test that a Pod and PVC attached to a GCEPD successfully unmounts and detaches when the encompassing Namespace is deleted.
It("should test that deleting the Namespace of a PVC and Pod causes the successful detach of Persistent Disk", func() {
ginkgo.It("should test that deleting the Namespace of a PVC and Pod causes the successful detach of Persistent Disk", func() {
By("Deleting the Namespace")
ginkgo.By("Deleting the Namespace")
err := c.CoreV1().Namespaces().Delete(ns, nil)
framework.ExpectNoError(err)
err = framework.WaitForNamespacesDeleted(c, []string{ns}, framework.DefaultNamespaceDeletionTimeout)
framework.ExpectNoError(err)
By("Verifying Persistent Disk detaches")
ginkgo.By("Verifying Persistent Disk detaches")
framework.ExpectNoError(waitForPDDetach(diskName, node), "PD ", diskName, " did not detach")
})
})
......@@ -19,8 +19,8 @@ package storage
import (
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
......@@ -48,7 +48,7 @@ var _ = utils.SIGDescribe("PV Protection", func() {
)
f := framework.NewDefaultFramework("pv-protection")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
client = f.ClientSet
nameSpace = f.Namespace.Name
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(client, framework.TestContext.NodeSchedulableTimeout))
......@@ -73,60 +73,60 @@ var _ = utils.SIGDescribe("PV Protection", func() {
StorageClassName: &emptyStorageClass,
}
By("Creating a PV")
ginkgo.By("Creating a PV")
// make the pv definitions
pv = framework.MakePersistentVolume(pvConfig)
// create the PV
pv, err = client.CoreV1().PersistentVolumes().Create(pv)
framework.ExpectNoError(err, "Error creating PV")
By("Waiting for PV to enter phase Available")
ginkgo.By("Waiting for PV to enter phase Available")
framework.ExpectNoError(framework.WaitForPersistentVolumePhase(v1.VolumeAvailable, client, pv.Name, 1*time.Second, 30*time.Second))
By("Checking that PV Protection finalizer is set")
ginkgo.By("Checking that PV Protection finalizer is set")
pv, err = client.CoreV1().PersistentVolumes().Get(pv.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "While getting PV status")
Expect(slice.ContainsString(pv.ObjectMeta.Finalizers, volumeutil.PVProtectionFinalizer, nil)).To(BeTrue(), "PV Protection finalizer(%v) is not set in %v", volumeutil.PVProtectionFinalizer, pv.ObjectMeta.Finalizers)
gomega.Expect(slice.ContainsString(pv.ObjectMeta.Finalizers, volumeutil.PVProtectionFinalizer, nil)).To(gomega.BeTrue(), "PV Protection finalizer(%v) is not set in %v", volumeutil.PVProtectionFinalizer, pv.ObjectMeta.Finalizers)
})
AfterEach(func() {
ginkgo.AfterEach(func() {
e2elog.Logf("AfterEach: Cleaning up test resources.")
if errs := framework.PVPVCCleanup(client, nameSpace, pv, pvc); len(errs) > 0 {
framework.Failf("AfterEach: Failed to delete PVC and/or PV. Errors: %v", utilerrors.NewAggregate(errs))
}
})
It("Verify \"immediate\" deletion of a PV that is not bound to a PVC", func() {
By("Deleting the PV")
ginkgo.It("Verify \"immediate\" deletion of a PV that is not bound to a PVC", func() {
ginkgo.By("Deleting the PV")
err = client.CoreV1().PersistentVolumes().Delete(pv.Name, metav1.NewDeleteOptions(0))
framework.ExpectNoError(err, "Error deleting PV")
framework.WaitForPersistentVolumeDeleted(client, pv.Name, framework.Poll, framework.PVDeletingTimeout)
})
It("Verify that PV bound to a PVC is not removed immediately", func() {
By("Creating a PVC")
ginkgo.It("Verify that PV bound to a PVC is not removed immediately", func() {
ginkgo.By("Creating a PVC")
pvc = framework.MakePersistentVolumeClaim(pvcConfig, nameSpace)
pvc, err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(pvc)
framework.ExpectNoError(err, "Error creating PVC")
By("Waiting for PVC to become Bound")
ginkgo.By("Waiting for PVC to become Bound")
err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, client, nameSpace, pvc.Name, framework.Poll, framework.ClaimBindingTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
By("Deleting the PV, however, the PV must not be removed from the system as it's bound to a PVC")
ginkgo.By("Deleting the PV, however, the PV must not be removed from the system as it's bound to a PVC")
err = client.CoreV1().PersistentVolumes().Delete(pv.Name, metav1.NewDeleteOptions(0))
framework.ExpectNoError(err, "Error deleting PV")
By("Checking that the PV status is Terminating")
ginkgo.By("Checking that the PV status is Terminating")
pv, err = client.CoreV1().PersistentVolumes().Get(pv.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "While checking PV status")
Expect(pv.ObjectMeta.DeletionTimestamp).NotTo(Equal(nil))
gomega.Expect(pv.ObjectMeta.DeletionTimestamp).NotTo(gomega.Equal(nil))
By("Deleting the PVC that is bound to the PV")
ginkgo.By("Deleting the PVC that is bound to the PV")
err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Delete(pvc.Name, metav1.NewDeleteOptions(0))
framework.ExpectNoError(err, "Error deleting PVC")
By("Checking that the PV is automatically removed from the system because it's no longer bound to a PVC")
ginkgo.By("Checking that the PV is automatically removed from the system because it's no longer bound to a PVC")
framework.WaitForPersistentVolumeDeleted(client, pv.Name, framework.Poll, framework.PVDeletingTimeout)
})
})
......@@ -17,8 +17,8 @@ limitations under the License.
package storage
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
......@@ -41,12 +41,12 @@ var _ = utils.SIGDescribe("PVC Protection", func() {
)
f := framework.NewDefaultFramework("pvc-protection")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
client = f.ClientSet
nameSpace = f.Namespace.Name
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(client, framework.TestContext.NodeSchedulableTimeout))
By("Creating a PVC")
ginkgo.By("Creating a PVC")
suffix := "pvc-protection"
framework.SkipIfNoDefaultStorageClass(client)
testStorageClass := testsuites.StorageClassTest{
......@@ -57,86 +57,86 @@ var _ = utils.SIGDescribe("PVC Protection", func() {
framework.ExpectNoError(err, "Error creating PVC")
pvcCreatedAndNotDeleted = true
By("Creating a Pod that becomes Running and therefore is actively using the PVC")
ginkgo.By("Creating a Pod that becomes Running and therefore is actively using the PVC")
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
pod, err = framework.CreatePod(client, nameSpace, nil, pvcClaims, false, "")
framework.ExpectNoError(err, "While creating pod that uses the PVC or waiting for the Pod to become Running")
By("Waiting for PVC to become Bound")
ginkgo.By("Waiting for PVC to become Bound")
err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, client, nameSpace, pvc.Name, framework.Poll, framework.ClaimBindingTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
By("Checking that PVC Protection finalizer is set")
ginkgo.By("Checking that PVC Protection finalizer is set")
pvc, err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(pvc.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "While getting PVC status")
Expect(slice.ContainsString(pvc.ObjectMeta.Finalizers, volumeutil.PVCProtectionFinalizer, nil)).To(BeTrue(), "PVC Protection finalizer(%v) is not set in %v", volumeutil.PVCProtectionFinalizer, pvc.ObjectMeta.Finalizers)
gomega.Expect(slice.ContainsString(pvc.ObjectMeta.Finalizers, volumeutil.PVCProtectionFinalizer, nil)).To(gomega.BeTrue(), "PVC Protection finalizer(%v) is not set in %v", volumeutil.PVCProtectionFinalizer, pvc.ObjectMeta.Finalizers)
})
AfterEach(func() {
ginkgo.AfterEach(func() {
if pvcCreatedAndNotDeleted {
framework.DeletePersistentVolumeClaim(client, pvc.Name, nameSpace)
}
})
It("Verify \"immediate\" deletion of a PVC that is not in active use by a pod", func() {
By("Deleting the pod using the PVC")
ginkgo.It("Verify \"immediate\" deletion of a PVC that is not in active use by a pod", func() {
ginkgo.By("Deleting the pod using the PVC")
err = framework.DeletePodWithWait(f, client, pod)
framework.ExpectNoError(err, "Error terminating and deleting pod")
By("Deleting the PVC")
ginkgo.By("Deleting the PVC")
err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Delete(pvc.Name, metav1.NewDeleteOptions(0))
framework.ExpectNoError(err, "Error deleting PVC")
framework.WaitForPersistentVolumeClaimDeleted(client, pvc.Namespace, pvc.Name, framework.Poll, framework.ClaimDeletingTimeout)
pvcCreatedAndNotDeleted = false
})
It("Verify that PVC in active use by a pod is not removed immediately", func() {
By("Deleting the PVC, however, the PVC must not be removed from the system as it's in active use by a pod")
ginkgo.It("Verify that PVC in active use by a pod is not removed immediately", func() {
ginkgo.By("Deleting the PVC, however, the PVC must not be removed from the system as it's in active use by a pod")
err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Delete(pvc.Name, metav1.NewDeleteOptions(0))
framework.ExpectNoError(err, "Error deleting PVC")
By("Checking that the PVC status is Terminating")
ginkgo.By("Checking that the PVC status is Terminating")
pvc, err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(pvc.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "While checking PVC status")
Expect(pvc.ObjectMeta.DeletionTimestamp).NotTo(Equal(nil))
gomega.Expect(pvc.ObjectMeta.DeletionTimestamp).NotTo(gomega.Equal(nil))
By("Deleting the pod that uses the PVC")
ginkgo.By("Deleting the pod that uses the PVC")
err = framework.DeletePodWithWait(f, client, pod)
framework.ExpectNoError(err, "Error terminating and deleting pod")
By("Checking that the PVC is automatically removed from the system because it's no longer in active use by a pod")
ginkgo.By("Checking that the PVC is automatically removed from the system because it's no longer in active use by a pod")
framework.WaitForPersistentVolumeClaimDeleted(client, pvc.Namespace, pvc.Name, framework.Poll, framework.ClaimDeletingTimeout)
pvcCreatedAndNotDeleted = false
})
It("Verify that scheduling of a pod that uses PVC that is being deleted fails and the pod becomes Unschedulable", func() {
By("Deleting the PVC, however, the PVC must not be removed from the system as it's in active use by a pod")
ginkgo.It("Verify that scheduling of a pod that uses PVC that is being deleted fails and the pod becomes Unschedulable", func() {
ginkgo.By("Deleting the PVC, however, the PVC must not be removed from the system as it's in active use by a pod")
err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Delete(pvc.Name, metav1.NewDeleteOptions(0))
framework.ExpectNoError(err, "Error deleting PVC")
By("Checking that the PVC status is Terminating")
ginkgo.By("Checking that the PVC status is Terminating")
pvc, err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(pvc.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "While checking PVC status")
Expect(pvc.ObjectMeta.DeletionTimestamp).NotTo(Equal(nil))
gomega.Expect(pvc.ObjectMeta.DeletionTimestamp).NotTo(gomega.Equal(nil))
By("Creating second Pod whose scheduling fails because it uses a PVC that is being deleted")
ginkgo.By("Creating second Pod whose scheduling fails because it uses a PVC that is being deleted")
secondPod, err2 := framework.CreateUnschedulablePod(client, nameSpace, nil, []*v1.PersistentVolumeClaim{pvc}, false, "")
framework.ExpectNoError(err2, "While creating second pod that uses a PVC that is being deleted and that is Unschedulable")
By("Deleting the second pod that uses the PVC that is being deleted")
ginkgo.By("Deleting the second pod that uses the PVC that is being deleted")
err = framework.DeletePodWithWait(f, client, secondPod)
framework.ExpectNoError(err, "Error terminating and deleting pod")
By("Checking again that the PVC status is Terminating")
ginkgo.By("Checking again that the PVC status is Terminating")
pvc, err = client.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(pvc.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "While checking PVC status")
Expect(pvc.ObjectMeta.DeletionTimestamp).NotTo(Equal(nil))
gomega.Expect(pvc.ObjectMeta.DeletionTimestamp).NotTo(gomega.Equal(nil))
By("Deleting the first pod that uses the PVC")
ginkgo.By("Deleting the first pod that uses the PVC")
err = framework.DeletePodWithWait(f, client, pod)
framework.ExpectNoError(err, "Error terminating and deleting pod")
By("Checking that the PVC is automatically removed from the system because it's no longer in active use by a pod")
ginkgo.By("Checking that the PVC is automatically removed from the system because it's no longer in active use by a pod")
framework.WaitForPersistentVolumeClaimDeleted(client, pvc.Namespace, pvc.Name, framework.Poll, framework.ClaimDeletingTimeout)
pvcCreatedAndNotDeleted = false
})
......
......@@ -17,8 +17,8 @@ limitations under the License.
package storage
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
"fmt"
"strings"
......@@ -60,7 +60,7 @@ var _ = utils.SIGDescribe("Regional PD", func() {
var c clientset.Interface
var ns string
BeforeEach(func() {
ginkgo.BeforeEach(func() {
c = f.ClientSet
ns = f.Namespace.Name
......@@ -68,26 +68,26 @@ var _ = utils.SIGDescribe("Regional PD", func() {
framework.SkipUnlessMultizone(c)
})
Describe("RegionalPD", func() {
It("should provision storage [Slow]", func() {
ginkgo.Describe("RegionalPD", func() {
ginkgo.It("should provision storage [Slow]", func() {
testVolumeProvisioning(c, ns)
})
It("should provision storage with delayed binding [Slow]", func() {
ginkgo.It("should provision storage with delayed binding [Slow]", func() {
testRegionalDelayedBinding(c, ns, 1 /* pvcCount */)
testRegionalDelayedBinding(c, ns, 3 /* pvcCount */)
})
It("should provision storage in the allowedTopologies [Slow]", func() {
ginkgo.It("should provision storage in the allowedTopologies [Slow]", func() {
testRegionalAllowedTopologies(c, ns)
})
It("should provision storage in the allowedTopologies with delayed binding [Slow]", func() {
ginkgo.It("should provision storage in the allowedTopologies with delayed binding [Slow]", func() {
testRegionalAllowedTopologiesWithDelayedBinding(c, ns, 1 /* pvcCount */)
testRegionalAllowedTopologiesWithDelayedBinding(c, ns, 3 /* pvcCount */)
})
It("should failover to a different zone when all nodes in one zone become unreachable [Slow] [Disruptive]", func() {
ginkgo.It("should failover to a different zone when all nodes in one zone become unreachable [Slow] [Disruptive]", func() {
testZonalFailover(c, ns)
})
})
......@@ -112,7 +112,7 @@ func testVolumeProvisioning(c clientset.Interface, ns string) {
ExpectedSize: repdMinSize,
PvCheck: func(claim *v1.PersistentVolumeClaim) {
volume := testsuites.PVWriteReadSingleNodeCheck(c, claim, framework.NodeSelection{})
Expect(volume).NotTo(BeNil())
gomega.Expect(volume).NotTo(gomega.BeNil())
err := checkGCEPD(volume, "pd-standard")
framework.ExpectNoError(err, "checkGCEPD")
......@@ -133,7 +133,7 @@ func testVolumeProvisioning(c clientset.Interface, ns string) {
ExpectedSize: repdMinSize,
PvCheck: func(claim *v1.PersistentVolumeClaim) {
volume := testsuites.PVWriteReadSingleNodeCheck(c, claim, framework.NodeSelection{})
Expect(volume).NotTo(BeNil())
gomega.Expect(volume).NotTo(gomega.BeNil())
err := checkGCEPD(volume, "pd-standard")
framework.ExpectNoError(err, "checkGCEPD")
......@@ -174,7 +174,7 @@ func testZonalFailover(c clientset.Interface, ns string) {
claimTemplate.Spec.StorageClassName = &class.Name
statefulSet, service, regionalPDLabels := newStatefulSet(claimTemplate, ns)
By("creating a StorageClass " + class.Name)
ginkgo.By("creating a StorageClass " + class.Name)
_, err := c.StorageV1().StorageClasses().Create(class)
framework.ExpectNoError(err)
defer func() {
......@@ -183,7 +183,7 @@ func testZonalFailover(c clientset.Interface, ns string) {
"Error deleting StorageClass %s", class.Name)
}()
By("creating a StatefulSet")
ginkgo.By("creating a StatefulSet")
_, err = c.CoreV1().Services(ns).Create(service)
framework.ExpectNoError(err)
_, err = c.AppsV1().StatefulSets(ns).Create(statefulSet)
......@@ -210,24 +210,24 @@ func testZonalFailover(c clientset.Interface, ns string) {
err = framework.WaitForStatefulSetReplicasReady(statefulSet.Name, ns, c, framework.Poll, statefulSetReadyTimeout)
if err != nil {
pod := getPod(c, ns, regionalPDLabels)
Expect(podutil.IsPodReadyConditionTrue(pod.Status)).To(BeTrue(),
gomega.Expect(podutil.IsPodReadyConditionTrue(pod.Status)).To(gomega.BeTrue(),
"The statefulset pod has the following conditions: %s", pod.Status.Conditions)
framework.ExpectNoError(err)
}
pvc := getPVC(c, ns, regionalPDLabels)
By("getting zone information from pod")
ginkgo.By("getting zone information from pod")
pod := getPod(c, ns, regionalPDLabels)
nodeName := pod.Spec.NodeName
node, err := c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
Expect(err).ToNot(HaveOccurred())
gomega.Expect(err).ToNot(gomega.HaveOccurred())
podZone := node.Labels[v1.LabelZoneFailureDomain]
By("tainting nodes in the zone the pod is scheduled in")
ginkgo.By("tainting nodes in the zone the pod is scheduled in")
selector := labels.SelectorFromSet(labels.Set(map[string]string{v1.LabelZoneFailureDomain: podZone}))
nodesInZone, err := c.CoreV1().Nodes().List(metav1.ListOptions{LabelSelector: selector.String()})
Expect(err).ToNot(HaveOccurred())
gomega.Expect(err).ToNot(gomega.HaveOccurred())
removeTaintFunc := addTaint(c, ns, nodesInZone.Items, podZone)
defer func() {
......@@ -235,11 +235,11 @@ func testZonalFailover(c clientset.Interface, ns string) {
removeTaintFunc()
}()
By("deleting StatefulSet pod")
ginkgo.By("deleting StatefulSet pod")
err = c.CoreV1().Pods(ns).Delete(pod.Name, &metav1.DeleteOptions{})
// Verify the pod is scheduled in the other zone.
By("verifying the pod is scheduled in a different zone.")
ginkgo.By("verifying the pod is scheduled in a different zone.")
var otherZone string
if cloudZones[0] == podZone {
otherZone = cloudZones[1]
......@@ -262,22 +262,22 @@ func testZonalFailover(c clientset.Interface, ns string) {
err = framework.WaitForStatefulSetReplicasReady(statefulSet.Name, ns, c, 3*time.Second, framework.RestartPodReadyAgainTimeout)
if err != nil {
pod := getPod(c, ns, regionalPDLabels)
Expect(podutil.IsPodReadyConditionTrue(pod.Status)).To(BeTrue(),
gomega.Expect(podutil.IsPodReadyConditionTrue(pod.Status)).To(gomega.BeTrue(),
"The statefulset pod has the following conditions: %s", pod.Status.Conditions)
framework.ExpectNoError(err)
}
By("verifying the same PVC is used by the new pod")
Expect(getPVC(c, ns, regionalPDLabels).Name).To(Equal(pvc.Name),
ginkgo.By("verifying the same PVC is used by the new pod")
gomega.Expect(getPVC(c, ns, regionalPDLabels).Name).To(gomega.Equal(pvc.Name),
"The same PVC should be used after failover.")
By("verifying the container output has 2 lines, indicating the pod has been created twice using the same regional PD.")
ginkgo.By("verifying the container output has 2 lines, indicating the pod has been created twice using the same regional PD.")
logs, err := framework.GetPodLogs(c, ns, pod.Name, "")
framework.ExpectNoError(err,
"Error getting logs from pod %s in namespace %s", pod.Name, ns)
lineCount := len(strings.Split(strings.TrimSpace(logs), "\n"))
expectedLineCount := 2
Expect(lineCount).To(Equal(expectedLineCount),
gomega.Expect(lineCount).To(gomega.Equal(expectedLineCount),
"Line count of the written file should be %d.", expectedLineCount)
}
......@@ -305,13 +305,13 @@ func addTaint(c clientset.Interface, ns string, nodes []v1.Node, podZone string)
reversePatches[node.Name] = reversePatchBytes
_, err = c.CoreV1().Nodes().Patch(node.Name, types.StrategicMergePatchType, patchBytes)
Expect(err).ToNot(HaveOccurred())
gomega.Expect(err).ToNot(gomega.HaveOccurred())
}
return func() {
for nodeName, reversePatch := range reversePatches {
_, err := c.CoreV1().Nodes().Patch(nodeName, types.StrategicMergePatchType, reversePatch)
Expect(err).ToNot(HaveOccurred())
gomega.Expect(err).ToNot(gomega.HaveOccurred())
}
}
}
......@@ -425,7 +425,7 @@ func getPVC(c clientset.Interface, ns string, pvcLabels map[string]string) *v1.P
options := metav1.ListOptions{LabelSelector: selector.String()}
pvcList, err := c.CoreV1().PersistentVolumeClaims(ns).List(options)
framework.ExpectNoError(err)
Expect(len(pvcList.Items)).To(Equal(1), "There should be exactly 1 PVC matched.")
gomega.Expect(len(pvcList.Items)).To(gomega.Equal(1), "There should be exactly 1 PVC matched.")
return &pvcList.Items[0]
}
......@@ -435,7 +435,7 @@ func getPod(c clientset.Interface, ns string, podLabels map[string]string) *v1.P
options := metav1.ListOptions{LabelSelector: selector.String()}
podList, err := c.CoreV1().Pods(ns).List(options)
framework.ExpectNoError(err)
Expect(len(podList.Items)).To(Equal(1), "There should be exactly 1 pod matched.")
gomega.Expect(len(podList.Items)).To(gomega.Equal(1), "There should be exactly 1 pod matched.")
return &podList.Items[0]
}
......@@ -534,8 +534,8 @@ func newPodTemplate(labels map[string]string) *v1.PodTemplateSpec {
func getTwoRandomZones(c clientset.Interface) []string {
zones, err := framework.GetClusterZones(c)
Expect(err).ToNot(HaveOccurred())
Expect(zones.Len()).To(BeNumerically(">=", 2),
gomega.Expect(err).ToNot(gomega.HaveOccurred())
gomega.Expect(zones.Len()).To(gomega.BeNumerically(">=", 2),
"The test should only be run in multizone clusters.")
zone1, _ := zones.PopAny()
......
......@@ -24,18 +24,18 @@ import (
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"k8s.io/kubernetes/test/e2e/storage/utils"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
)
var _ = utils.SIGDescribe("Subpath", func() {
f := framework.NewDefaultFramework("subpath")
Context("Atomic writer volumes", func() {
ginkgo.Context("Atomic writer volumes", func() {
var err error
var privilegedSecurityContext bool = false
BeforeEach(func() {
By("Setting up data")
ginkgo.BeforeEach(func() {
ginkgo.By("Setting up data")
secret := &v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "my-secret"}, Data: map[string][]byte{"secret-key": []byte("secret-value")}}
secret, err = f.ClientSet.CoreV1().Secrets(f.Namespace.Name).Create(secret)
if err != nil && !apierrors.IsAlreadyExists(err) {
......
......@@ -24,7 +24,7 @@ import (
"strings"
"time"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
......@@ -88,8 +88,8 @@ func DefineTestSuite(driver TestDriver, tsInits []func() TestSuite) {
suite := testSuiteInit()
for _, pattern := range suite.getTestSuiteInfo().testPatterns {
p := pattern
Context(getTestNameStr(suite, p), func() {
BeforeEach(func() {
ginkgo.Context(getTestNameStr(suite, p), func() {
ginkgo.BeforeEach(func() {
// Skip unsupported tests to avoid unnecessary resource initialization
skipUnsupportedTest(driver, p)
})
......@@ -214,7 +214,7 @@ func createGenericVolumeTestResource(driver TestDriver, config *PerTestConfig, p
claimSize := dDriver.GetClaimSize()
r.sc = dDriver.GetDynamicProvisionStorageClass(r.config, fsType)
By("creating a StorageClass " + r.sc.Name)
ginkgo.By("creating a StorageClass " + r.sc.Name)
var err error
r.sc, err = cs.StorageV1().StorageClasses().Create(r.sc)
framework.ExpectNoError(err)
......@@ -244,12 +244,12 @@ func (r *genericVolumeTestResource) cleanupResource() {
if r.pvc != nil || r.pv != nil {
switch volType {
case testpatterns.PreprovisionedPV:
By("Deleting pv and pvc")
ginkgo.By("Deleting pv and pvc")
if errs := framework.PVPVCCleanup(f.ClientSet, f.Namespace.Name, r.pv, r.pvc); len(errs) != 0 {
framework.Failf("Failed to delete PVC or PV: %v", utilerrors.NewAggregate(errs))
}
case testpatterns.DynamicPV:
By("Deleting pvc")
ginkgo.By("Deleting pvc")
// We only delete the PVC so that PV (and disk) can be cleaned up by dynamic provisioner
if r.pv != nil && r.pv.Spec.PersistentVolumeReclaimPolicy != v1.PersistentVolumeReclaimDelete {
framework.Failf("Test framework does not currently support Dynamically Provisioned Persistent Volume %v specified with reclaim policy that isnt %v",
......@@ -269,7 +269,7 @@ func (r *genericVolumeTestResource) cleanupResource() {
}
if r.sc != nil {
By("Deleting sc")
ginkgo.By("Deleting sc")
deleteStorageClass(f.ClientSet, r.sc.Name)
}
......@@ -330,7 +330,7 @@ func createVolumeSourceWithPVCPVFromDynamicProvisionSC(
cs := f.ClientSet
ns := f.Namespace.Name
By("creating a claim")
ginkgo.By("creating a claim")
pvc := getClaim(claimSize, ns)
pvc.Spec.StorageClassName = &sc.Name
if volMode != "" {
......@@ -455,12 +455,12 @@ func StartPodLogs(f *framework.Framework) func() {
ns := f.Namespace
to := podlogs.LogOutput{
StatusWriter: GinkgoWriter,
StatusWriter: ginkgo.GinkgoWriter,
}
if framework.TestContext.ReportDir == "" {
to.LogWriter = GinkgoWriter
to.LogWriter = ginkgo.GinkgoWriter
} else {
test := CurrentGinkgoTestDescription()
test := ginkgo.CurrentGinkgoTestDescription()
reg := regexp.MustCompile("[^a-zA-Z0-9_-]+")
// We end the prefix with a slash to ensure that all logs
// end up in a directory named after the current test.
......@@ -476,7 +476,7 @@ func StartPodLogs(f *framework.Framework) func() {
// after a failed test. Logging them live is only useful for interactive
// debugging, not when we collect reports.
if framework.TestContext.ReportDir == "" {
podlogs.WatchPods(ctx, cs, ns.Name, GinkgoWriter)
podlogs.WatchPods(ctx, cs, ns.Name, ginkgo.GinkgoWriter)
}
return cancel
......
......@@ -20,8 +20,8 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
......@@ -82,9 +82,9 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
dDriver DynamicPVTestDriver
)
BeforeEach(func() {
ginkgo.BeforeEach(func() {
// Check preconditions.
Expect(pattern.SnapshotType).To(Equal(testpatterns.DynamicCreatedSnapshot))
gomega.Expect(pattern.SnapshotType).To(gomega.Equal(testpatterns.DynamicCreatedSnapshot))
dInfo := driver.GetDriverInfo()
ok := false
sDriver, ok = driver.(SnapshottableTestDriver)
......@@ -103,7 +103,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
// f must run inside an It or Context callback.
f := framework.NewDefaultFramework("snapshotting")
It("should create snapshot with defaults [Feature:VolumeSnapshotDataSource]", func() {
ginkgo.It("should create snapshot with defaults [Feature:VolumeSnapshotDataSource]", func() {
cs := f.ClientSet
dc := f.DynamicClient
......@@ -122,7 +122,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
pvc.Spec.StorageClassName = &class.Name
e2elog.Logf("In creating storage class object and pvc object for driver - sc: %v, pvc: %v", class, pvc)
By("creating a StorageClass " + class.Name)
ginkgo.By("creating a StorageClass " + class.Name)
class, err := cs.StorageV1().StorageClasses().Create(class)
framework.ExpectNoError(err)
defer func() {
......@@ -130,7 +130,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
framework.ExpectNoError(cs.StorageV1().StorageClasses().Delete(class.Name, nil))
}()
By("creating a claim")
ginkgo.By("creating a claim")
pvc, err = cs.CoreV1().PersistentVolumeClaims(pvc.Namespace).Create(pvc)
framework.ExpectNoError(err)
defer func() {
......@@ -144,7 +144,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, cs, pvc.Namespace, pvc.Name, framework.Poll, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err)
By("checking the claim")
ginkgo.By("checking the claim")
// Get new copy of the claim
pvc, err = cs.CoreV1().PersistentVolumeClaims(pvc.Namespace).Get(pvc.Name, metav1.GetOptions{})
framework.ExpectNoError(err)
......@@ -153,7 +153,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
pv, err := cs.CoreV1().PersistentVolumes().Get(pvc.Spec.VolumeName, metav1.GetOptions{})
framework.ExpectNoError(err)
By("creating a SnapshotClass")
ginkgo.By("creating a SnapshotClass")
vsc, err = dc.Resource(snapshotClassGVR).Create(vsc, metav1.CreateOptions{})
framework.ExpectNoError(err)
defer func() {
......@@ -161,7 +161,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
framework.ExpectNoError(dc.Resource(snapshotClassGVR).Delete(vsc.GetName(), nil))
}()
By("creating a snapshot")
ginkgo.By("creating a snapshot")
snapshot := getSnapshot(pvc.Name, pvc.Namespace, vsc.GetName())
snapshot, err = dc.Resource(snapshotGVR).Namespace(snapshot.GetNamespace()).Create(snapshot, metav1.CreateOptions{})
......@@ -177,7 +177,7 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
err = WaitForSnapshotReady(dc, snapshot.GetNamespace(), snapshot.GetName(), framework.Poll, framework.SnapshotCreateTimeout)
framework.ExpectNoError(err)
By("checking the snapshot")
ginkgo.By("checking the snapshot")
// Get new copy of the snapshot
snapshot, err = dc.Resource(snapshotGVR).Namespace(snapshot.GetNamespace()).Get(snapshot.GetName(), metav1.GetOptions{})
framework.ExpectNoError(err)
......@@ -193,11 +193,11 @@ func (s *snapshottableTestSuite) defineTests(driver TestDriver, pattern testpatt
persistentVolumeRef := snapshotContentSpec["persistentVolumeRef"].(map[string]interface{})
// Check SnapshotContent properties
By("checking the SnapshotContent")
Expect(snapshotContentSpec["snapshotClassName"]).To(Equal(vsc.GetName()))
Expect(volumeSnapshotRef["name"]).To(Equal(snapshot.GetName()))
Expect(volumeSnapshotRef["namespace"]).To(Equal(snapshot.GetNamespace()))
Expect(persistentVolumeRef["name"]).To(Equal(pv.Name))
ginkgo.By("checking the SnapshotContent")
gomega.Expect(snapshotContentSpec["snapshotClassName"]).To(gomega.Equal(vsc.GetName()))
gomega.Expect(volumeSnapshotRef["name"]).To(gomega.Equal(snapshot.GetName()))
gomega.Expect(volumeSnapshotRef["namespace"]).To(gomega.Equal(snapshot.GetNamespace()))
gomega.Expect(persistentVolumeRef["name"]).To(gomega.Equal(pv.Name))
})
}
......
......@@ -29,7 +29,7 @@ import (
"strings"
"time"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
......@@ -126,7 +126,7 @@ func (t *volumeIOTestSuite) defineTests(driver TestDriver, pattern testpatterns.
validateMigrationVolumeOpCounts(f.ClientSet, dInfo.InTreePluginName, l.intreeOps, l.migratedOps)
}
It("should write files of various sizes, verify size, validate content [Slow]", func() {
ginkgo.It("should write files of various sizes, verify size, validate content [Slow]", func() {
init()
defer cleanup()
......@@ -230,7 +230,7 @@ func makePodSpec(config volume.TestConfig, initCmd string, volsrc v1.VolumeSourc
// Write `fsize` bytes to `fpath` in the pod, using dd and the `ddInput` file.
func writeToFile(pod *v1.Pod, fpath, ddInput string, fsize int64) error {
By(fmt.Sprintf("writing %d bytes to test file %s", fsize, fpath))
ginkgo.By(fmt.Sprintf("writing %d bytes to test file %s", fsize, fpath))
loopCnt := fsize / testpatterns.MinFileSize
writeCmd := fmt.Sprintf("i=0; while [ $i -lt %d ]; do dd if=%s bs=%d >>%s 2>/dev/null; let i+=1; done", loopCnt, ddInput, testpatterns.MinFileSize, fpath)
_, err := utils.PodExec(pod, writeCmd)
......@@ -240,7 +240,7 @@ func writeToFile(pod *v1.Pod, fpath, ddInput string, fsize int64) error {
// Verify that the test file is the expected size and contains the expected content.
func verifyFile(pod *v1.Pod, fpath string, expectSize int64, ddInput string) error {
By("verifying file size")
ginkgo.By("verifying file size")
rtnstr, err := utils.PodExec(pod, fmt.Sprintf("stat -c %%s %s", fpath))
if err != nil || rtnstr == "" {
return fmt.Errorf("unable to get file size via `stat %s`: %v", fpath, err)
......@@ -253,7 +253,7 @@ func verifyFile(pod *v1.Pod, fpath string, expectSize int64, ddInput string) err
return fmt.Errorf("size of file %s is %d, expected %d", fpath, size, expectSize)
}
By("verifying file hash")
ginkgo.By("verifying file hash")
rtnstr, err = utils.PodExec(pod, fmt.Sprintf("md5sum %s | cut -d' ' -f1", fpath))
if err != nil {
return fmt.Errorf("unable to test file hash via `md5sum %s`: %v", fpath, err)
......@@ -274,7 +274,7 @@ func verifyFile(pod *v1.Pod, fpath string, expectSize int64, ddInput string) err
// Delete `fpath` to save some disk space on host. Delete errors are logged but ignored.
func deleteFile(pod *v1.Pod, fpath string) {
By(fmt.Sprintf("deleting test file %s...", fpath))
ginkgo.By(fmt.Sprintf("deleting test file %s...", fpath))
_, err := utils.PodExec(pod, fmt.Sprintf("rm -f %s", fpath))
if err != nil {
// keep going, the test dir will be deleted when the volume is unmounted
......@@ -299,7 +299,7 @@ func testVolumeIO(f *framework.Framework, cs clientset.Interface, config volume.
clientPod := makePodSpec(config, initCmd, volsrc, podSecContext)
By(fmt.Sprintf("starting %s", clientPod.Name))
ginkgo.By(fmt.Sprintf("starting %s", clientPod.Name))
podsNamespacer := cs.CoreV1().Pods(config.Namespace)
clientPod, err = podsNamespacer.Create(clientPod)
if err != nil {
......@@ -307,7 +307,7 @@ func testVolumeIO(f *framework.Framework, cs clientset.Interface, config volume.
}
defer func() {
deleteFile(clientPod, ddInput)
By(fmt.Sprintf("deleting client pod %q...", clientPod.Name))
ginkgo.By(fmt.Sprintf("deleting client pod %q...", clientPod.Name))
e := framework.DeletePodWithWait(f, cs, clientPod)
if e != nil {
e2elog.Logf("client pod failed to delete: %v", e)
......
......@@ -19,8 +19,7 @@ package testsuites
import (
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
v1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
......@@ -166,17 +165,17 @@ func (t *volumeModeTestSuite) defineTests(driver TestDriver, pattern testpattern
switch pattern.VolType {
case testpatterns.PreprovisionedPV:
if pattern.VolMode == v1.PersistentVolumeBlock && !isBlockSupported {
It("should fail to create pod by failing to mount volume [Slow]", func() {
ginkgo.It("should fail to create pod by failing to mount volume [Slow]", func() {
init()
defer cleanup()
var err error
By("Creating sc")
ginkgo.By("Creating sc")
l.sc, err = l.cs.StorageV1().StorageClasses().Create(l.sc)
framework.ExpectNoError(err)
By("Creating pv and pvc")
ginkgo.By("Creating pv and pvc")
l.pv, err = l.cs.CoreV1().PersistentVolumes().Create(l.pv)
framework.ExpectNoError(err)
......@@ -187,27 +186,27 @@ func (t *volumeModeTestSuite) defineTests(driver TestDriver, pattern testpattern
framework.ExpectNoError(framework.WaitOnPVandPVC(l.cs, l.ns.Name, l.pv, l.pvc))
By("Creating pod")
ginkgo.By("Creating pod")
pod, err := framework.CreateSecPodWithNodeSelection(l.cs, l.ns.Name, []*v1.PersistentVolumeClaim{l.pvc},
false, "", false, false, framework.SELinuxLabel,
nil, framework.NodeSelection{Name: l.config.ClientNodeName}, framework.PodStartTimeout)
defer func() {
framework.ExpectNoError(framework.DeletePodWithWait(f, l.cs, pod))
}()
Expect(err).To(HaveOccurred())
gomega.Expect(err).To(gomega.HaveOccurred())
})
} else {
It("should create sc, pod, pv, and pvc, read/write to the pv, and delete all created resources", func() {
ginkgo.It("should create sc, pod, pv, and pvc, read/write to the pv, and delete all created resources", func() {
init()
defer cleanup()
var err error
By("Creating sc")
ginkgo.By("Creating sc")
l.sc, err = l.cs.StorageV1().StorageClasses().Create(l.sc)
framework.ExpectNoError(err)
By("Creating pv and pvc")
ginkgo.By("Creating pv and pvc")
l.pv, err = l.cs.CoreV1().PersistentVolumes().Create(l.pv)
framework.ExpectNoError(err)
......@@ -218,7 +217,7 @@ func (t *volumeModeTestSuite) defineTests(driver TestDriver, pattern testpattern
framework.ExpectNoError(framework.WaitOnPVandPVC(l.cs, l.ns.Name, l.pv, l.pvc))
By("Creating pod")
ginkgo.By("Creating pod")
pod, err := framework.CreateSecPodWithNodeSelection(l.cs, l.ns.Name, []*v1.PersistentVolumeClaim{l.pvc},
false, "", false, false, framework.SELinuxLabel,
nil, framework.NodeSelection{Name: l.config.ClientNodeName}, framework.PodStartTimeout)
......@@ -227,45 +226,45 @@ func (t *volumeModeTestSuite) defineTests(driver TestDriver, pattern testpattern
}()
framework.ExpectNoError(err)
By("Checking if persistent volume exists as expected volume mode")
ginkgo.By("Checking if persistent volume exists as expected volume mode")
utils.CheckVolumeModeOfPath(pod, pattern.VolMode, "/mnt/volume1")
By("Checking if read/write to persistent volume works properly")
ginkgo.By("Checking if read/write to persistent volume works properly")
utils.CheckReadWriteToPath(pod, pattern.VolMode, "/mnt/volume1")
})
// TODO(mkimuram): Add more tests
}
case testpatterns.DynamicPV:
if pattern.VolMode == v1.PersistentVolumeBlock && !isBlockSupported {
It("should fail in binding dynamic provisioned PV to PVC", func() {
ginkgo.It("should fail in binding dynamic provisioned PV to PVC", func() {
init()
defer cleanup()
var err error
By("Creating sc")
ginkgo.By("Creating sc")
l.sc, err = l.cs.StorageV1().StorageClasses().Create(l.sc)
framework.ExpectNoError(err)
By("Creating pv and pvc")
ginkgo.By("Creating pv and pvc")
l.pvc, err = l.cs.CoreV1().PersistentVolumeClaims(l.ns.Name).Create(l.pvc)
framework.ExpectNoError(err)
err = framework.WaitForPersistentVolumeClaimPhase(v1.ClaimBound, l.cs, l.pvc.Namespace, l.pvc.Name, framework.Poll, framework.ClaimProvisionTimeout)
Expect(err).To(HaveOccurred())
gomega.Expect(err).To(gomega.HaveOccurred())
})
} else {
It("should create sc, pod, pv, and pvc, read/write to the pv, and delete all created resources", func() {
ginkgo.It("should create sc, pod, pv, and pvc, read/write to the pv, and delete all created resources", func() {
init()
defer cleanup()
var err error
By("Creating sc")
ginkgo.By("Creating sc")
l.sc, err = l.cs.StorageV1().StorageClasses().Create(l.sc)
framework.ExpectNoError(err)
By("Creating pv and pvc")
ginkgo.By("Creating pv and pvc")
l.pvc, err = l.cs.CoreV1().PersistentVolumeClaims(l.ns.Name).Create(l.pvc)
framework.ExpectNoError(err)
......@@ -278,7 +277,7 @@ func (t *volumeModeTestSuite) defineTests(driver TestDriver, pattern testpattern
l.pv, err = l.cs.CoreV1().PersistentVolumes().Get(l.pvc.Spec.VolumeName, metav1.GetOptions{})
framework.ExpectNoError(err)
By("Creating pod")
ginkgo.By("Creating pod")
pod, err := framework.CreateSecPodWithNodeSelection(l.cs, l.ns.Name, []*v1.PersistentVolumeClaim{l.pvc},
false, "", false, false, framework.SELinuxLabel,
nil, framework.NodeSelection{Name: l.config.ClientNodeName}, framework.PodStartTimeout)
......@@ -287,10 +286,10 @@ func (t *volumeModeTestSuite) defineTests(driver TestDriver, pattern testpattern
}()
framework.ExpectNoError(err)
By("Checking if persistent volume exists as expected volume mode")
ginkgo.By("Checking if persistent volume exists as expected volume mode")
utils.CheckVolumeModeOfPath(pod, pattern.VolMode, "/mnt/volume1")
By("Checking if read/write to persistent volume works properly")
ginkgo.By("Checking if read/write to persistent volume works properly")
utils.CheckReadWriteToPath(pod, pattern.VolMode, "/mnt/volume1")
})
// TODO(mkimuram): Add more tests
......
......@@ -24,7 +24,7 @@ package testsuites
import (
"fmt"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
......@@ -140,7 +140,7 @@ func (t *volumesTestSuite) defineTests(driver TestDriver, pattern testpatterns.T
validateMigrationVolumeOpCounts(f.ClientSet, dInfo.InTreePluginName, l.intreeOps, l.migratedOps)
}
It("should be mountable", func() {
ginkgo.It("should be mountable", func() {
skipPersistenceTest(driver)
init()
defer func() {
......@@ -171,7 +171,7 @@ func (t *volumesTestSuite) defineTests(driver TestDriver, pattern testpatterns.T
volume.TestVolumeClient(f.ClientSet, config, fsGroup, pattern.FsType, tests)
})
It("should allow exec of files on the volume", func() {
ginkgo.It("should allow exec of files on the volume", func() {
skipExecTest(driver)
init()
defer cleanup()
......@@ -229,10 +229,10 @@ func testScriptInPod(
NodeName: config.ClientNodeName,
},
}
By(fmt.Sprintf("Creating pod %s", pod.Name))
ginkgo.By(fmt.Sprintf("Creating pod %s", pod.Name))
f.TestContainerOutput("exec-volume-test", pod, 0, []string{fileName})
By(fmt.Sprintf("Deleting pod %s", pod.Name))
ginkgo.By(fmt.Sprintf("Deleting pod %s", pod.Name))
err := framework.DeletePodWithWait(f, f.ClientSet, pod)
framework.ExpectNoError(err, "while deleting pod")
}
......@@ -25,7 +25,7 @@ import (
"path/filepath"
"strings"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/uuid"
"k8s.io/kubernetes/test/e2e/framework"
......@@ -99,7 +99,7 @@ func (l *ltrMgr) getTestDir() string {
func (l *ltrMgr) setupLocalVolumeTmpfs(node *v1.Node, parameters map[string]string) *LocalTestResource {
hostDir := l.getTestDir()
By(fmt.Sprintf("Creating tmpfs mount point on node %q at path %q", node.Name, hostDir))
ginkgo.By(fmt.Sprintf("Creating tmpfs mount point on node %q at path %q", node.Name, hostDir))
err := l.hostExec.IssueCommand(fmt.Sprintf("mkdir -p %q && sudo mount -t tmpfs -o size=10m tmpfs-%q %q", hostDir, hostDir, hostDir), node)
framework.ExpectNoError(err)
return &LocalTestResource{
......@@ -109,18 +109,18 @@ func (l *ltrMgr) setupLocalVolumeTmpfs(node *v1.Node, parameters map[string]stri
}
func (l *ltrMgr) cleanupLocalVolumeTmpfs(ltr *LocalTestResource) {
By(fmt.Sprintf("Unmount tmpfs mount point on node %q at path %q", ltr.Node.Name, ltr.Path))
ginkgo.By(fmt.Sprintf("Unmount tmpfs mount point on node %q at path %q", ltr.Node.Name, ltr.Path))
err := l.hostExec.IssueCommand(fmt.Sprintf("sudo umount %q", ltr.Path), ltr.Node)
framework.ExpectNoError(err)
By("Removing the test directory")
ginkgo.By("Removing the test directory")
err = l.hostExec.IssueCommand(fmt.Sprintf("rm -r %s", ltr.Path), ltr.Node)
framework.ExpectNoError(err)
}
// createAndSetupLoopDevice creates an empty file and associates a loop devie with it.
func (l *ltrMgr) createAndSetupLoopDevice(dir string, node *v1.Node, size int) {
By(fmt.Sprintf("Creating block device on node %q using path %q", node.Name, dir))
ginkgo.By(fmt.Sprintf("Creating block device on node %q using path %q", node.Name, dir))
mkdirCmd := fmt.Sprintf("mkdir -p %s", dir)
count := size / 4096
// xfs requires at least 4096 blocks
......@@ -155,7 +155,7 @@ func (l *ltrMgr) setupLocalVolumeBlock(node *v1.Node, parameters map[string]stri
// teardownLoopDevice tears down loop device by its associated storage directory.
func (l *ltrMgr) teardownLoopDevice(dir string, node *v1.Node) {
loopDev := l.findLoopDevice(dir, node)
By(fmt.Sprintf("Tear down block device %q on node %q at path %s/file", loopDev, node.Name, dir))
ginkgo.By(fmt.Sprintf("Tear down block device %q on node %q at path %s/file", loopDev, node.Name, dir))
losetupDeleteCmd := fmt.Sprintf("sudo losetup -d %s", loopDev)
err := l.hostExec.IssueCommand(losetupDeleteCmd, node)
framework.ExpectNoError(err)
......@@ -164,7 +164,7 @@ func (l *ltrMgr) teardownLoopDevice(dir string, node *v1.Node) {
func (l *ltrMgr) cleanupLocalVolumeBlock(ltr *LocalTestResource) {
l.teardownLoopDevice(ltr.loopDir, ltr.Node)
By(fmt.Sprintf("Removing the test directory %s", ltr.loopDir))
ginkgo.By(fmt.Sprintf("Removing the test directory %s", ltr.loopDir))
removeCmd := fmt.Sprintf("rm -r %s", ltr.loopDir)
err := l.hostExec.IssueCommand(removeCmd, ltr.Node)
framework.ExpectNoError(err)
......@@ -204,7 +204,7 @@ func (l *ltrMgr) setupLocalVolumeDirectory(node *v1.Node, parameters map[string]
}
func (l *ltrMgr) cleanupLocalVolumeDirectory(ltr *LocalTestResource) {
By("Removing the test directory")
ginkgo.By("Removing the test directory")
removeCmd := fmt.Sprintf("rm -r %s", ltr.Path)
err := l.hostExec.IssueCommand(removeCmd, ltr.Node)
framework.ExpectNoError(err)
......@@ -223,7 +223,7 @@ func (l *ltrMgr) setupLocalVolumeDirectoryLink(node *v1.Node, parameters map[str
}
func (l *ltrMgr) cleanupLocalVolumeDirectoryLink(ltr *LocalTestResource) {
By("Removing the test directory")
ginkgo.By("Removing the test directory")
hostDir := ltr.Path
hostDirBackend := hostDir + "-backend"
removeCmd := fmt.Sprintf("sudo rm -r %s && rm -r %s", hostDir, hostDirBackend)
......@@ -243,7 +243,7 @@ func (l *ltrMgr) setupLocalVolumeDirectoryBindMounted(node *v1.Node, parameters
}
func (l *ltrMgr) cleanupLocalVolumeDirectoryBindMounted(ltr *LocalTestResource) {
By("Removing the test directory")
ginkgo.By("Removing the test directory")
hostDir := ltr.Path
removeCmd := fmt.Sprintf("sudo umount %s && rm -r %s", hostDir, hostDir)
err := l.hostExec.IssueCommand(removeCmd, ltr.Node)
......@@ -263,7 +263,7 @@ func (l *ltrMgr) setupLocalVolumeDirectoryLinkBindMounted(node *v1.Node, paramet
}
func (l *ltrMgr) cleanupLocalVolumeDirectoryLinkBindMounted(ltr *LocalTestResource) {
By("Removing the test directory")
ginkgo.By("Removing the test directory")
hostDir := ltr.Path
hostDirBackend := hostDir + "-backend"
removeCmd := fmt.Sprintf("sudo rm %s && sudo umount %s && rm -r %s", hostDir, hostDirBackend, hostDirBackend)
......
......@@ -25,8 +25,8 @@ import (
"strings"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
......@@ -82,7 +82,7 @@ func VerifyExecInPodFail(pod *v1.Pod, bashExec string, exitCode int) {
if err != nil {
if err, ok := err.(uexec.CodeExitError); ok {
actualExitCode := err.ExitStatus()
Expect(actualExitCode).To(Equal(exitCode),
gomega.Expect(actualExitCode).To(gomega.Equal(exitCode),
"%q should fail with exit code %d, but failed with exit code %d and error message %q",
bashExec, exitCode, actualExitCode, err)
} else {
......@@ -91,7 +91,7 @@ func VerifyExecInPodFail(pod *v1.Pod, bashExec string, exitCode int) {
bashExec, exitCode, err)
}
}
Expect(err).To(HaveOccurred(), "%q should fail with exit code %d, but exit without error", bashExec, exitCode)
gomega.Expect(err).To(gomega.HaveOccurred(), "%q should fail with exit code %d, but exit without error", bashExec, exitCode)
}
// KubeletCommand performs `start`, `restart`, or `stop` on the kubelet running on the node of the target pod and waits
......@@ -138,7 +138,7 @@ func KubeletCommand(kOp KubeletOpt, c clientset.Interface, pod *v1.Pod) {
sshResult, err = e2essh.SSH(command, nodeIP, framework.TestContext.Provider)
framework.ExpectNoError(err, fmt.Sprintf("SSH to Node %q errored.", pod.Spec.NodeName))
e2essh.LogResult(sshResult)
Expect(sshResult.Code).To(BeZero(), "Failed to [%s] kubelet:\n%#v", string(kOp), sshResult)
gomega.Expect(sshResult.Code).To(gomega.BeZero(), "Failed to [%s] kubelet:\n%#v", string(kOp), sshResult)
if kOp == KStop {
if ok := framework.WaitForNodeToBeNotReady(c, pod.Spec.NodeName, NodeStateTimeout); !ok {
......@@ -155,7 +155,7 @@ func KubeletCommand(kOp KubeletOpt, c clientset.Interface, pod *v1.Pod) {
break
}
}
Expect(isPidChanged).To(BeTrue(), "Kubelet PID remained unchanged after restarting Kubelet")
gomega.Expect(isPidChanged).To(gomega.BeTrue(), "Kubelet PID remained unchanged after restarting Kubelet")
e2elog.Logf("Noticed that kubelet PID is changed. Waiting for 30 Seconds for Kubelet to come back")
time.Sleep(30 * time.Second)
}
......@@ -182,23 +182,23 @@ func getKubeletMainPid(nodeIP string, sudoPresent bool, systemctlPresent bool) s
sshResult, err := e2essh.SSH(command, nodeIP, framework.TestContext.Provider)
framework.ExpectNoError(err, fmt.Sprintf("SSH to Node %q errored.", nodeIP))
e2essh.LogResult(sshResult)
Expect(sshResult.Code).To(BeZero(), "Failed to get kubelet PID")
Expect(sshResult.Stdout).NotTo(BeEmpty(), "Kubelet Main PID should not be Empty")
gomega.Expect(sshResult.Code).To(gomega.BeZero(), "Failed to get kubelet PID")
gomega.Expect(sshResult.Stdout).NotTo(gomega.BeEmpty(), "Kubelet Main PID should not be Empty")
return sshResult.Stdout
}
// TestKubeletRestartsAndRestoresMount tests that a volume mounted to a pod remains mounted after a kubelet restarts
func TestKubeletRestartsAndRestoresMount(c clientset.Interface, f *framework.Framework, clientPod *v1.Pod) {
By("Writing to the volume.")
ginkgo.By("Writing to the volume.")
file := "/mnt/_SUCCESS"
out, err := PodExec(clientPod, fmt.Sprintf("touch %s", file))
e2elog.Logf(out)
framework.ExpectNoError(err)
By("Restarting kubelet")
ginkgo.By("Restarting kubelet")
KubeletCommand(KRestart, c, clientPod)
By("Testing that written file is accessible.")
ginkgo.By("Testing that written file is accessible.")
out, err = PodExec(clientPod, fmt.Sprintf("cat %s", file))
e2elog.Logf(out)
framework.ExpectNoError(err)
......@@ -212,28 +212,28 @@ func TestVolumeUnmountsFromDeletedPodWithForceOption(c clientset.Interface, f *f
framework.ExpectNoError(err)
nodeIP = nodeIP + ":22"
By("Expecting the volume mount to be found.")
ginkgo.By("Expecting the volume mount to be found.")
result, err := e2essh.SSH(fmt.Sprintf("mount | grep %s | grep -v volume-subpaths", clientPod.UID), nodeIP, framework.TestContext.Provider)
e2essh.LogResult(result)
framework.ExpectNoError(err, "Encountered SSH error.")
Expect(result.Code).To(BeZero(), fmt.Sprintf("Expected grep exit code of 0, got %d", result.Code))
gomega.Expect(result.Code).To(gomega.BeZero(), fmt.Sprintf("Expected grep exit code of 0, got %d", result.Code))
if checkSubpath {
By("Expecting the volume subpath mount to be found.")
ginkgo.By("Expecting the volume subpath mount to be found.")
result, err := e2essh.SSH(fmt.Sprintf("cat /proc/self/mountinfo | grep %s | grep volume-subpaths", clientPod.UID), nodeIP, framework.TestContext.Provider)
e2essh.LogResult(result)
framework.ExpectNoError(err, "Encountered SSH error.")
Expect(result.Code).To(BeZero(), fmt.Sprintf("Expected grep exit code of 0, got %d", result.Code))
gomega.Expect(result.Code).To(gomega.BeZero(), fmt.Sprintf("Expected grep exit code of 0, got %d", result.Code))
}
// This command is to make sure kubelet is started after test finishes no matter it fails or not.
defer func() {
KubeletCommand(KStart, c, clientPod)
}()
By("Stopping the kubelet.")
ginkgo.By("Stopping the kubelet.")
KubeletCommand(KStop, c, clientPod)
By(fmt.Sprintf("Deleting Pod %q", clientPod.Name))
ginkgo.By(fmt.Sprintf("Deleting Pod %q", clientPod.Name))
if forceDelete {
err = c.CoreV1().Pods(clientPod.Namespace).Delete(clientPod.Name, metav1.NewDeleteOptions(0))
} else {
......@@ -241,7 +241,7 @@ func TestVolumeUnmountsFromDeletedPodWithForceOption(c clientset.Interface, f *f
}
framework.ExpectNoError(err)
By("Starting the kubelet and waiting for pod to delete.")
ginkgo.By("Starting the kubelet and waiting for pod to delete.")
KubeletCommand(KStart, c, clientPod)
err = f.WaitForPodNotFound(clientPod.Name, framework.PodDeleteTimeout)
if err != nil {
......@@ -254,19 +254,19 @@ func TestVolumeUnmountsFromDeletedPodWithForceOption(c clientset.Interface, f *f
time.Sleep(30 * time.Second)
}
By("Expecting the volume mount not to be found.")
ginkgo.By("Expecting the volume mount not to be found.")
result, err = e2essh.SSH(fmt.Sprintf("mount | grep %s | grep -v volume-subpaths", clientPod.UID), nodeIP, framework.TestContext.Provider)
e2essh.LogResult(result)
framework.ExpectNoError(err, "Encountered SSH error.")
Expect(result.Stdout).To(BeEmpty(), "Expected grep stdout to be empty (i.e. no mount found).")
gomega.Expect(result.Stdout).To(gomega.BeEmpty(), "Expected grep stdout to be empty (i.e. no mount found).")
e2elog.Logf("Volume unmounted on node %s", clientPod.Spec.NodeName)
if checkSubpath {
By("Expecting the volume subpath mount not to be found.")
ginkgo.By("Expecting the volume subpath mount not to be found.")
result, err = e2essh.SSH(fmt.Sprintf("cat /proc/self/mountinfo | grep %s | grep volume-subpaths", clientPod.UID), nodeIP, framework.TestContext.Provider)
e2essh.LogResult(result)
framework.ExpectNoError(err, "Encountered SSH error.")
Expect(result.Stdout).To(BeEmpty(), "Expected grep stdout to be empty (i.e. no subpath mount found).")
gomega.Expect(result.Stdout).To(gomega.BeEmpty(), "Expected grep stdout to be empty (i.e. no subpath mount found).")
e2elog.Logf("Subpath volume unmounted on node %s", clientPod.Spec.NodeName)
}
}
......@@ -394,7 +394,7 @@ func StartExternalProvisioner(c clientset.Interface, ns string, externalPluginNa
framework.ExpectNoError(framework.WaitForPodRunningInNamespace(c, provisionerPod))
By("locating the provisioner pod")
ginkgo.By("locating the provisioner pod")
pod, err := podClient.Get(provisionerPod.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "Cannot locate the provisioner pod %v: %v", provisionerPod.Name, err)
......@@ -411,7 +411,7 @@ func PrivilegedTestPSPClusterRoleBinding(client clientset.Interface,
}
roleBindingClient := client.RbacV1().RoleBindings(namespace)
for _, saName := range saNames {
By(fmt.Sprintf("%v priviledged Pod Security Policy to the service account %s", bindingString, saName))
ginkgo.By(fmt.Sprintf("%v priviledged Pod Security Policy to the service account %s", bindingString, saName))
binding := &rbacv1.RoleBinding{
ObjectMeta: metav1.ObjectMeta{
Name: "psp-" + saName,
......
......@@ -20,8 +20,8 @@ import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1"
......@@ -51,7 +51,7 @@ var _ = utils.SIGDescribe("Volume expand", func() {
)
f := framework.NewDefaultFramework("volume-expand")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("aws", "gce")
c = f.ClientSet
ns = f.Namespace.Name
......@@ -82,39 +82,39 @@ var _ = utils.SIGDescribe("Volume expand", func() {
return tPVC, sc, nil
}
AfterEach(func() {
ginkgo.AfterEach(func() {
framework.ExpectNoError(framework.DeletePersistentVolumeClaim(c, pvc.Name, pvc.Namespace))
framework.ExpectNoError(c.StorageV1().StorageClasses().Delete(storageClassVar.Name, nil))
})
It("should not allow expansion of pvcs without AllowVolumeExpansion property", func() {
ginkgo.It("should not allow expansion of pvcs without AllowVolumeExpansion property", func() {
pvc, storageClassVar, err = setupFunc(false /* allowExpansion */, false /*BlockVolume*/)
framework.ExpectNoError(err, "Error creating non-expandable PVC")
Expect(storageClassVar.AllowVolumeExpansion).To(BeNil())
gomega.Expect(storageClassVar.AllowVolumeExpansion).To(gomega.BeNil())
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
Expect(len(pvs)).To(Equal(1))
gomega.Expect(len(pvs)).To(gomega.Equal(1))
By("Expanding non-expandable pvc")
ginkgo.By("Expanding non-expandable pvc")
newSize := resource.MustParse("6Gi")
pvc, err = expandPVCSize(pvc, newSize, c)
Expect(err).To(HaveOccurred(), "While updating non-expandable PVC")
gomega.Expect(err).To(gomega.HaveOccurred(), "While updating non-expandable PVC")
})
It("Verify if editing PVC allows resize", func() {
ginkgo.It("Verify if editing PVC allows resize", func() {
pvc, storageClassVar, err = setupFunc(true /* allowExpansion */, false /*BlockVolume*/)
framework.ExpectNoError(err, "Error creating non-expandable PVC")
By("Waiting for pvc to be in bound phase")
ginkgo.By("Waiting for pvc to be in bound phase")
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
Expect(len(pvs)).To(Equal(1))
gomega.Expect(len(pvs)).To(gomega.Equal(1))
By("Creating a pod with dynamically provisioned volume")
ginkgo.By("Creating a pod with dynamically provisioned volume")
pod, err := framework.CreatePod(c, ns, nil, pvcClaims, false, "")
framework.ExpectNoError(err, "While creating pods for resizing")
defer func() {
......@@ -122,34 +122,34 @@ var _ = utils.SIGDescribe("Volume expand", func() {
framework.ExpectNoError(err, "while cleaning up pod already deleted in resize test")
}()
By("Expanding current pvc")
ginkgo.By("Expanding current pvc")
newSize := resource.MustParse("6Gi")
pvc, err = expandPVCSize(pvc, newSize, c)
framework.ExpectNoError(err, "While updating pvc for more size")
Expect(pvc).NotTo(BeNil())
gomega.Expect(pvc).NotTo(gomega.BeNil())
pvcSize := pvc.Spec.Resources.Requests[v1.ResourceStorage]
if pvcSize.Cmp(newSize) != 0 {
framework.Failf("error updating pvc size %q", pvc.Name)
}
By("Waiting for cloudprovider resize to finish")
ginkgo.By("Waiting for cloudprovider resize to finish")
err = waitForControllerVolumeResize(pvc, c, totalResizeWaitPeriod)
framework.ExpectNoError(err, "While waiting for pvc resize to finish")
By("Checking for conditions on pvc")
ginkgo.By("Checking for conditions on pvc")
pvc, err = c.CoreV1().PersistentVolumeClaims(ns).Get(pvc.Name, metav1.GetOptions{})
framework.ExpectNoError(err, "While fetching pvc after controller resize")
inProgressConditions := pvc.Status.Conditions
Expect(len(inProgressConditions)).To(Equal(1), "pvc must have file system resize pending condition")
Expect(inProgressConditions[0].Type).To(Equal(v1.PersistentVolumeClaimFileSystemResizePending), "pvc must have fs resizing condition")
gomega.Expect(len(inProgressConditions)).To(gomega.Equal(1), "pvc must have file system resize pending condition")
gomega.Expect(inProgressConditions[0].Type).To(gomega.Equal(v1.PersistentVolumeClaimFileSystemResizePending), "pvc must have fs resizing condition")
By("Deleting the previously created pod")
ginkgo.By("Deleting the previously created pod")
err = framework.DeletePodWithWait(f, c, pod)
framework.ExpectNoError(err, "while deleting pod for resizing")
By("Creating a new pod with same volume")
ginkgo.By("Creating a new pod with same volume")
pod2, err := framework.CreatePod(c, ns, nil, pvcClaims, false, "")
framework.ExpectNoError(err, "while recreating pod for resizing")
defer func() {
......@@ -157,44 +157,44 @@ var _ = utils.SIGDescribe("Volume expand", func() {
framework.ExpectNoError(err, "while cleaning up pod before exiting resizing test")
}()
By("Waiting for file system resize to finish")
ginkgo.By("Waiting for file system resize to finish")
pvc, err = waitForFSResize(pvc, c)
framework.ExpectNoError(err, "while waiting for fs resize to finish")
pvcConditions := pvc.Status.Conditions
Expect(len(pvcConditions)).To(Equal(0), "pvc should not have conditions")
gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions")
})
It("should allow expansion of block volumes", func() {
ginkgo.It("should allow expansion of block volumes", func() {
pvc, storageClassVar, err = setupFunc(true /*allowExpansion*/, true /*blockVolume*/)
By("Waiting for pvc to be in bound phase")
ginkgo.By("Waiting for pvc to be in bound phase")
pvcClaims := []*v1.PersistentVolumeClaim{pvc}
pvs, err := framework.WaitForPVClaimBoundPhase(c, pvcClaims, framework.ClaimProvisionTimeout)
framework.ExpectNoError(err, "Failed waiting for PVC to be bound %v", err)
Expect(len(pvs)).To(Equal(1))
gomega.Expect(len(pvs)).To(gomega.Equal(1))
By("Expanding current pvc")
ginkgo.By("Expanding current pvc")
newSize := resource.MustParse("6Gi")
pvc, err = expandPVCSize(pvc, newSize, c)
framework.ExpectNoError(err, "While updating pvc for more size")
Expect(pvc).NotTo(BeNil())
gomega.Expect(pvc).NotTo(gomega.BeNil())
pvcSize := pvc.Spec.Resources.Requests[v1.ResourceStorage]
if pvcSize.Cmp(newSize) != 0 {
framework.Failf("error updating pvc size %q", pvc.Name)
}
By("Waiting for cloudprovider resize to finish")
ginkgo.By("Waiting for cloudprovider resize to finish")
err = waitForControllerVolumeResize(pvc, c, totalResizeWaitPeriod)
framework.ExpectNoError(err, "While waiting for pvc resize to finish")
By("Waiting for file system resize to finish")
ginkgo.By("Waiting for file system resize to finish")
pvc, err = waitForFSResize(pvc, c)
framework.ExpectNoError(err, "while waiting for fs resize to finish")
pvcConditions := pvc.Status.Conditions
Expect(len(pvcConditions)).To(Equal(0), "pvc should not have conditions")
gomega.Expect(len(pvcConditions)).To(gomega.Equal(0), "pvc should not have conditions")
})
})
......
......@@ -17,7 +17,7 @@ limitations under the License.
package storage
import (
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
......@@ -30,13 +30,13 @@ var _ = utils.SIGDescribe("Volume limits", func() {
c clientset.Interface
)
f := framework.NewDefaultFramework("volume-limits-on-node")
BeforeEach(func() {
ginkgo.BeforeEach(func() {
framework.SkipUnlessProviderIs("aws", "gce", "gke")
c = f.ClientSet
framework.ExpectNoError(framework.WaitForAllNodesSchedulable(c, framework.TestContext.NodeSchedulableTimeout))
})
It("should verify that all nodes have volume limits", func() {
ginkgo.It("should verify that all nodes have volume limits", func() {
nodeList := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
if len(nodeList.Items) == 0 {
framework.Failf("Unable to find ready and schedulable Node")
......
......@@ -18,7 +18,7 @@ limitations under the License.
package storage
import (
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clientset "k8s.io/client-go/kubernetes"
......@@ -36,13 +36,13 @@ var _ = utils.SIGDescribe("Volumes", func() {
var cs clientset.Interface
var namespace *v1.Namespace
BeforeEach(func() {
ginkgo.BeforeEach(func() {
cs = f.ClientSet
namespace = f.Namespace
})
Describe("ConfigMap", func() {
It("should be mountable", func() {
ginkgo.Describe("ConfigMap", func() {
ginkgo.It("should be mountable", func() {
config := volume.TestConfig{
Namespace: namespace.Name,
Prefix: "configmap",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment