Merge pull request #102292 from tsmetana/fix-local-pv-e2e-pv-leak

Local PV e2e: fix leaked local volumes
This commit is contained in:
Kubernetes Prow Robot 2021-05-31 08:28:26 -07:00 committed by GitHub
commit c4df930252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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{})