}) }) <del> Context("when pod using local volume with non-existant path", func() { ep := &eventPatterns{ reason:  "FailedMount", pattern: make([]string, 2)} ep.pattern = append(ep.pattern, "MountVolume.SetUp failed") ep.pattern = append(ep.pattern, "does not exist") It("should not be able to mount", func() { testVol := &localTestVolume{ node:            config.node0, hostDir:         "/non-existent/location/nowhere", localVolumeType: testVolType, } By("Creating local PVC and PV") createLocalPVCsPVs(config, []*localTestVolume{testVol}, testMode) pod, err := createLocalPod(config, testVol) Expect(err).To(HaveOccurred()) checkPodEvents(config, pod.Name, ep) verifyLocalVolume(config, testVol) cleanupLocalPVCsPVs(config, []*localTestVolume{testVol}) }) }) </del> <ins> }) } </ins> <del> Context("when pod's node is different from PV's NodeAffinity", func() { </del> <ins> Context("when local volume cannot be mounted [Slow]", func() { // TODO: // - make the pod create timeout shorter // - check for these errors in unit tests intead It("should fail mount due to non-existant path", func() { ep := &eventPatterns{ reason:  "FailedMount", pattern: make([]string, 2)} ep.pattern = append(ep.pattern, "MountVolume.SetUp failed") ep.pattern = append(ep.pattern, "does not exist") testVol := &localTestVolume{ node:            config.node0, hostDir:         "/non-existent/location/nowhere", localVolumeType: DirectoryLocalVolumeType, } By("Creating local PVC and PV") createLocalPVCsPVs(config, []*localTestVolume{testVol}, immediateMode) pod, err := createLocalPod(config, testVol) Expect(err).To(HaveOccurred()) checkPodEvents(config, pod.Name, ep) verifyLocalVolume(config, testVol) cleanupLocalPVCsPVs(config, []*localTestVolume{testVol}) }) </ins> <del> BeforeEach(func() { if len(config.nodes) < 2 { framework.Skipf("Runs only when number of nodes >= 2") } }) </del> <ins> It("should fail mount due to wrong node", func() { if len(config.nodes) < 2 { framework.Skipf("Runs only when number of nodes >= 2") } </ins> <del> ep := &eventPatterns{ reason:  "FailedScheduling", pattern: make([]string, 2)} ep.pattern = append(ep.pattern, "MatchNodeSelector") ep.pattern = append(ep.pattern, "VolumeNodeAffinityConflict") </del> <ins> ep := &eventPatterns{ reason:  "FailedMount", pattern: make([]string, 2)} ep.pattern = append(ep.pattern, "NodeSelectorTerm") ep.pattern = append(ep.pattern, "MountVolume.NodeAffinity check failed") </ins> <del> It("should not be able to mount due to different NodeAffinity", func() { testPodWithNodeName(config, testVolType, ep, config.nodes[1].Name, makeLocalPodWithNodeAffinity, testMode) }) </del> <ins> testVols := setupLocalVolumesPVCsPVs(config, DirectoryLocalVolumeType, config.node0, 1, immediateMode) testVol := testVols[0] </ins> <del> It("should not be able to mount due to different NodeSelector", func() { testPodWithNodeName(config, testVolType, ep, config.nodes[1].Name, makeLocalPodWithNodeSelector, testMode) }) </del> <ins> pod := makeLocalPodWithNodeName(config, testVol, config.nodes[1].Name) pod, err := config.client.CoreV1().Pods(config.ns).Create(pod) Expect(err).NotTo(HaveOccurred()) </ins> <del> }) </del> <ins> err = framework.WaitForPodNameRunningInNamespace(config.client, pod.Name, pod.Namespace) Expect(err).To(HaveOccurred()) checkPodEvents(config, pod.Name, ep) </ins> <del> Context("when pod's node is different from PV's NodeName", func() { </del> <ins> cleanupLocalVolumes(config, []*localTestVolume{testVol}) }) }) </ins> <del> BeforeEach(func() { if len(config.nodes) < 2 { framework.Skipf("Runs only when number of nodes >= 2") } }) </del> <ins> Context("when pod's node is different from PV's NodeAffinity", func() { var ( testVol    *localTestVolume volumeType localVolumeType ) BeforeEach(func() { if len(config.nodes) < 2 { framework.Skipf("Runs only when number of nodes >= 2") } </ins> <del> ep := &eventPatterns{ reason:  "FailedMount", pattern: make([]string, 2)} ep.pattern = append(ep.pattern, "NodeSelectorTerm") ep.pattern = append(ep.pattern, "MountVolume.NodeAffinity check failed") </del> <ins> volumeType = DirectoryLocalVolumeType setupStorageClass(config, &immediateMode) testVols := setupLocalVolumesPVCsPVs(config, volumeType, config.node0, 1, immediateMode) testVol = testVols[0] }) </ins> <del> It("should not be able to mount due to different NodeName", func() { testPodWithNodeName(config, testVolType, ep, config.nodes[1].Name, makeLocalPodWithNodeName, testMode) }) }) </del> <ins> AfterEach(func() { cleanupLocalVolumes(config, []*localTestVolume{testVol}) cleanupStorageClass(config) </ins> }) <del> } </del> <ins> It("should not be able to mount due to different NodeAffinity", func() { testPodWithNodeConflict(config, volumeType, config.nodes[1].Name, makeLocalPodWithNodeAffinity, immediateMode) }) It("should not be able to mount due to different NodeSelector", func() { testPodWithNodeConflict(config, volumeType, config.nodes[1].Name, makeLocalPodWithNodeSelector, immediateMode) }) }) </ins> Context("when using local volume provisioner", func() { var volumePath string