mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 18:31:15 +00:00
Merge pull request #95679 from EdDev/test-e2e-remove-w8-4-pod-running-after-createsync
test, e2e: Remove duplication when using PodClient.CreateSync
This commit is contained in:
commit
f00ec1b449
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -165,10 +164,7 @@ var _ = ginkgo.Describe("[sig-storage] Downward API volume", func() {
|
|||||||
|
|
||||||
containerName := "client-container"
|
containerName := "client-container"
|
||||||
ginkgo.By("Creating the pod")
|
ginkgo.By("Creating the pod")
|
||||||
podClient.CreateSync(pod)
|
pod = podClient.CreateSync(pod)
|
||||||
|
|
||||||
pod, err := podClient.Get(context.TODO(), pod.Name, metav1.GetOptions{})
|
|
||||||
framework.ExpectNoError(err, "Failed to get pod %q", pod.Name)
|
|
||||||
|
|
||||||
gomega.Eventually(func() (string, error) {
|
gomega.Eventually(func() (string, error) {
|
||||||
return e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName)
|
return e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName)
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
@ -26,7 +25,6 @@ import (
|
|||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/uuid"
|
"k8s.io/apimachinery/pkg/util/uuid"
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
|
||||||
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
||||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||||
)
|
)
|
||||||
@ -278,18 +276,9 @@ var _ = ginkgo.Describe("[sig-storage] EmptyDir volumes", func() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
|
||||||
ginkgo.By("Creating Pod")
|
ginkgo.By("Creating Pod")
|
||||||
pod = f.PodClient().CreateSync(pod)
|
pod = f.PodClient().CreateSync(pod)
|
||||||
|
|
||||||
ginkgo.By("Waiting for the pod running")
|
|
||||||
err = e2epod.WaitForPodNameRunningInNamespace(f.ClientSet, pod.Name, f.Namespace.Name)
|
|
||||||
framework.ExpectNoError(err, "failed to deploy pod %s", pod.Name)
|
|
||||||
|
|
||||||
ginkgo.By("Geting the pod")
|
|
||||||
pod, err = f.PodClient().Get(context.TODO(), pod.Name, metav1.GetOptions{})
|
|
||||||
framework.ExpectNoError(err, "failed to get pod %s", pod.Name)
|
|
||||||
|
|
||||||
ginkgo.By("Reading file content from the nginx-container")
|
ginkgo.By("Reading file content from the nginx-container")
|
||||||
result := f.ExecShellInContainer(pod.Name, busyBoxMainContainerName, fmt.Sprintf("cat %s", busyBoxMainVolumeFilePath))
|
result := f.ExecShellInContainer(pod.Name, busyBoxMainContainerName, fmt.Sprintf("cat %s", busyBoxMainVolumeFilePath))
|
||||||
framework.ExpectEqual(result, message, "failed to match expected string %s with %s", message, resultString)
|
framework.ExpectEqual(result, message, "failed to match expected string %s with %s", message, resultString)
|
||||||
|
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -165,10 +164,7 @@ var _ = ginkgo.Describe("[sig-storage] Projected downwardAPI", func() {
|
|||||||
|
|
||||||
containerName := "client-container"
|
containerName := "client-container"
|
||||||
ginkgo.By("Creating the pod")
|
ginkgo.By("Creating the pod")
|
||||||
podClient.CreateSync(pod)
|
pod = podClient.CreateSync(pod)
|
||||||
|
|
||||||
pod, err := podClient.Get(context.TODO(), pod.Name, metav1.GetOptions{})
|
|
||||||
framework.ExpectNoError(err, "Failed to get pod %q", pod.Name)
|
|
||||||
|
|
||||||
gomega.Eventually(func() (string, error) {
|
gomega.Eventually(func() (string, error) {
|
||||||
return e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName)
|
return e2epod.GetPodLogs(f.ClientSet, f.Namespace.Name, pod.Name, containerName)
|
||||||
|
@ -33,7 +33,6 @@ import (
|
|||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2edeployment "k8s.io/kubernetes/test/e2e/framework/deployment"
|
e2edeployment "k8s.io/kubernetes/test/e2e/framework/deployment"
|
||||||
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
|
||||||
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
|
|
||||||
e2eservice "k8s.io/kubernetes/test/e2e/framework/service"
|
e2eservice "k8s.io/kubernetes/test/e2e/framework/service"
|
||||||
imageutils "k8s.io/kubernetes/test/utils/image"
|
imageutils "k8s.io/kubernetes/test/utils/image"
|
||||||
netutils "k8s.io/utils/net"
|
netutils "k8s.io/utils/net"
|
||||||
@ -99,11 +98,7 @@ var _ = SIGDescribe("[Feature:IPv6DualStackAlphaFeature] [LinuxOnly]", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ginkgo.By("submitting the pod to kubernetes")
|
ginkgo.By("submitting the pod to kubernetes")
|
||||||
podClient.CreateSync(pod)
|
p := podClient.CreateSync(pod)
|
||||||
framework.ExpectNoError(e2epod.WaitForPodNameRunningInNamespace(f.ClientSet, pod.Name, f.Namespace.Name))
|
|
||||||
|
|
||||||
p, err := podClient.Get(context.TODO(), pod.Name, metav1.GetOptions{})
|
|
||||||
framework.ExpectNoError(err, "Failed to get pod %q", pod.Name)
|
|
||||||
|
|
||||||
gomega.Expect(p.Status.PodIP).ShouldNot(gomega.BeEquivalentTo(""))
|
gomega.Expect(p.Status.PodIP).ShouldNot(gomega.BeEquivalentTo(""))
|
||||||
gomega.Expect(p.Status.PodIPs).ShouldNot(gomega.BeNil())
|
gomega.Expect(p.Status.PodIPs).ShouldNot(gomega.BeNil())
|
||||||
@ -116,7 +111,7 @@ var _ = SIGDescribe("[Feature:IPv6DualStackAlphaFeature] [LinuxOnly]", func() {
|
|||||||
framework.ExpectEqual(isIPv4(p.Status.PodIPs[0].IP) != isIPv4(p.Status.PodIPs[1].IP), true)
|
framework.ExpectEqual(isIPv4(p.Status.PodIPs[0].IP) != isIPv4(p.Status.PodIPs[1].IP), true)
|
||||||
|
|
||||||
ginkgo.By("deleting the pod")
|
ginkgo.By("deleting the pod")
|
||||||
err = podClient.Delete(context.TODO(), pod.Name, *metav1.NewDeleteOptions(30))
|
err := podClient.Delete(context.TODO(), pod.Name, *metav1.NewDeleteOptions(30))
|
||||||
framework.ExpectNoError(err, "failed to delete pod")
|
framework.ExpectNoError(err, "failed to delete pod")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ var _ = framework.KubeDescribe("NodeProblemDetector [NodeFeature:NodeProblemDete
|
|||||||
ginkgo.By("Create the node problem detector")
|
ginkgo.By("Create the node problem detector")
|
||||||
hostPathType := new(v1.HostPathType)
|
hostPathType := new(v1.HostPathType)
|
||||||
*hostPathType = v1.HostPathType(string(v1.HostPathFileOrCreate))
|
*hostPathType = v1.HostPathType(string(v1.HostPathFileOrCreate))
|
||||||
f.PodClient().CreateSync(&v1.Pod{
|
pod := f.PodClient().CreateSync(&v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
},
|
},
|
||||||
@ -237,8 +237,6 @@ var _ = framework.KubeDescribe("NodeProblemDetector [NodeFeature:NodeProblemDete
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
pod, err := f.PodClient().Get(context.TODO(), name, metav1.GetOptions{})
|
|
||||||
framework.ExpectNoError(err)
|
|
||||||
// TODO: remove hardcoded kubelet volume directory path
|
// TODO: remove hardcoded kubelet volume directory path
|
||||||
// framework.TestContext.KubeVolumeDir is currently not populated for node e2e
|
// framework.TestContext.KubeVolumeDir is currently not populated for node e2e
|
||||||
hostLogFile = "/var/lib/kubelet/pods/" + string(pod.UID) + "/volumes/kubernetes.io~empty-dir" + logFile
|
hostLogFile = "/var/lib/kubelet/pods/" + string(pod.UID) + "/volumes/kubernetes.io~empty-dir" + logFile
|
||||||
|
Loading…
Reference in New Issue
Block a user