mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #73167 from cofyc/fix71570
Do not check events in local PV e2e tests
This commit is contained in:
commit
f1ecf470f2
@ -48,7 +48,6 @@ go_library(
|
|||||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/fields:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||||
|
@ -35,7 +35,6 @@ import (
|
|||||||
storagev1 "k8s.io/api/storage/v1"
|
storagev1 "k8s.io/api/storage/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
@ -326,25 +325,6 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
By("Deleting second pod")
|
By("Deleting second pod")
|
||||||
framework.DeletePodOrFail(config.client, config.ns, pod2.Name)
|
framework.DeletePodOrFail(config.client, config.ns, pod2.Name)
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should not set different fsGroups for two pods simultaneously", func() {
|
|
||||||
fsGroup1, fsGroup2 := int64(1234), int64(4321)
|
|
||||||
By("Create first pod and check fsGroup is set")
|
|
||||||
pod1 := createPodWithFsGroupTest(config, testVol, fsGroup1, fsGroup1)
|
|
||||||
By("Create second pod and check fsGroup is still the old one")
|
|
||||||
pod2 := createPodWithFsGroupTest(config, testVol, fsGroup2, fsGroup1)
|
|
||||||
ep := &eventPatterns{
|
|
||||||
reason: "AlreadyMountedVolume",
|
|
||||||
pattern: make([]string, 2),
|
|
||||||
}
|
|
||||||
ep.pattern = append(ep.pattern, fmt.Sprintf("The requested fsGroup is %d", fsGroup2))
|
|
||||||
ep.pattern = append(ep.pattern, "The volume may not be shareable.")
|
|
||||||
checkPodEvents(config, pod2.Name, ep)
|
|
||||||
By("Deleting first pod")
|
|
||||||
framework.DeletePodOrFail(config.client, config.ns, pod1.Name)
|
|
||||||
By("Deleting second pod")
|
|
||||||
framework.DeletePodOrFail(config.client, config.ns, pod2.Name)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -354,11 +334,6 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
// TODO:
|
// TODO:
|
||||||
// - check for these errors in unit tests instead
|
// - check for these errors in unit tests instead
|
||||||
It("should fail due to non-existent path", func() {
|
It("should fail due to non-existent path", func() {
|
||||||
ep := &eventPatterns{
|
|
||||||
reason: "FailedMount",
|
|
||||||
pattern: make([]string, 2)}
|
|
||||||
ep.pattern = append(ep.pattern, "MountVolume.NewMounter initialization failed")
|
|
||||||
|
|
||||||
testVol := &localTestVolume{
|
testVol := &localTestVolume{
|
||||||
node: config.node0,
|
node: config.node0,
|
||||||
hostDir: "/non-existent/location/nowhere",
|
hostDir: "/non-existent/location/nowhere",
|
||||||
@ -368,7 +343,8 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
createLocalPVCsPVs(config, []*localTestVolume{testVol}, immediateMode)
|
createLocalPVCsPVs(config, []*localTestVolume{testVol}, immediateMode)
|
||||||
pod, err := createLocalPod(config, testVol, nil)
|
pod, err := createLocalPod(config, testVol, nil)
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
checkPodEvents(config, pod.Name, ep)
|
err = framework.WaitTimeoutForPodRunningInNamespace(config.client, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
||||||
|
Expect(err).To(HaveOccurred())
|
||||||
cleanupLocalPVCsPVs(config, []*localTestVolume{testVol})
|
cleanupLocalPVCsPVs(config, []*localTestVolume{testVol})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -377,12 +353,6 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
framework.Skipf("Runs only when number of nodes >= 2")
|
framework.Skipf("Runs only when number of nodes >= 2")
|
||||||
}
|
}
|
||||||
|
|
||||||
ep := &eventPatterns{
|
|
||||||
reason: "FailedMount",
|
|
||||||
pattern: make([]string, 2)}
|
|
||||||
ep.pattern = append(ep.pattern, "NodeSelectorTerm")
|
|
||||||
ep.pattern = append(ep.pattern, "MountVolume.NodeAffinity check failed")
|
|
||||||
|
|
||||||
testVols := setupLocalVolumesPVCsPVs(config, DirectoryLocalVolumeType, config.node0, 1, immediateMode)
|
testVols := setupLocalVolumesPVCsPVs(config, DirectoryLocalVolumeType, config.node0, 1, immediateMode)
|
||||||
testVol := testVols[0]
|
testVol := testVols[0]
|
||||||
|
|
||||||
@ -392,7 +362,6 @@ var _ = utils.SIGDescribe("PersistentVolumes-local ", func() {
|
|||||||
|
|
||||||
err = framework.WaitTimeoutForPodRunningInNamespace(config.client, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
err = framework.WaitTimeoutForPodRunningInNamespace(config.client, pod.Name, pod.Namespace, framework.PodStartShortTimeout)
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
checkPodEvents(config, pod.Name, ep)
|
|
||||||
|
|
||||||
cleanupLocalVolumes(config, []*localTestVolume{testVol})
|
cleanupLocalVolumes(config, []*localTestVolume{testVol})
|
||||||
})
|
})
|
||||||
@ -754,28 +723,6 @@ func testPodWithNodeConflict(config *localTestConfig, testVolType localVolumeTyp
|
|||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
||||||
type eventPatterns struct {
|
|
||||||
reason string
|
|
||||||
pattern []string
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkPodEvents(config *localTestConfig, podName string, ep *eventPatterns) {
|
|
||||||
var events *v1.EventList
|
|
||||||
selector := fields.Set{
|
|
||||||
"involvedObject.kind": "Pod",
|
|
||||||
"involvedObject.name": podName,
|
|
||||||
"involvedObject.namespace": config.ns,
|
|
||||||
"reason": ep.reason,
|
|
||||||
}.AsSelector().String()
|
|
||||||
options := metav1.ListOptions{FieldSelector: selector}
|
|
||||||
events, err := config.client.CoreV1().Events(config.ns).List(options)
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
|
||||||
Expect(len(events.Items)).NotTo(Equal(0))
|
|
||||||
for _, p := range ep.pattern {
|
|
||||||
Expect(events.Items[0].Message).To(ContainSubstring(p))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The tests below are run against multiple mount point types
|
// The tests below are run against multiple mount point types
|
||||||
|
|
||||||
// Test two pods at the same time, write from pod1, and read from pod2
|
// Test two pods at the same time, write from pod1, and read from pod2
|
||||||
|
Loading…
Reference in New Issue
Block a user