Local PV e2e: fix leaked local volumes

This commit is contained in:
Tomas Smetana 2021-05-25 16:24:30 +02:00
parent 8634bc61c6
commit 2c79f52de9

View File

@ -373,11 +373,11 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
})
ginkgo.It("should fail scheduling due to different NodeAffinity", func() {
testPodWithNodeConflict(config, volumeType, conflictNodeName, makeLocalPodWithNodeAffinity, immediateMode)
testPodWithNodeConflict(config, testVol, conflictNodeName, makeLocalPodWithNodeAffinity)
})
ginkgo.It("should fail scheduling due to different NodeSelector", func() {
testPodWithNodeConflict(config, volumeType, conflictNodeName, makeLocalPodWithNodeSelector, immediateMode)
testPodWithNodeConflict(config, testVol, conflictNodeName, makeLocalPodWithNodeSelector)
})
})
@ -716,10 +716,8 @@ func deletePodAndPVCs(config *localTestConfig, pod *v1.Pod) error {
type makeLocalPodWith func(config *localTestConfig, volume *localTestVolume, nodeName string) *v1.Pod
func testPodWithNodeConflict(config *localTestConfig, testVolType localVolumeType, nodeName string, makeLocalPodFunc makeLocalPodWith, bindingMode storagev1.VolumeBindingMode) {
ginkgo.By(fmt.Sprintf("local-volume-type: %s", testVolType))
testVols := setupLocalVolumesPVCsPVs(config, testVolType, config.randomNode, 1, bindingMode)
testVol := testVols[0]
func testPodWithNodeConflict(config *localTestConfig, testVol *localTestVolume, nodeName string, makeLocalPodFunc makeLocalPodWith) {
ginkgo.By(fmt.Sprintf("local-volume-type: %s", testVol.localVolumeType))
pod := makeLocalPodFunc(config, testVol, nodeName)
pod, err := config.client.CoreV1().Pods(config.ns).Create(context.TODO(), pod, metav1.CreateOptions{})