Skip to content

Commit

Permalink
Merge pull request kubernetes#103349 from tsmetana/automated-cherry-p…
Browse files Browse the repository at this point in the history
…ick-of-#102292-upstream-release-1.21

Automated cherry pick of kubernetes#102292: Local PV e2e: fix leaked local volumes
  • Loading branch information
k8s-ci-robot committed Oct 6, 2021
2 parents 620e9cf + 8556ab5 commit f1682c6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions test/e2e/storage/persistent_volumes-local.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})

Expand Down Expand Up @@ -720,10 +720,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{})
Expand Down

0 comments on commit f1682c6

Please sign in to comment.