tests: Refactors agnhost image pod usage in tests

A previous commit created a few agnhost related functions that creates agnhost
pods / containers for general purposes.

Refactors tests to use those functions.
This commit is contained in:
Claudiu Belu
2019-12-17 17:22:46 +02:00
parent 131f42d263
commit 89eae73323
8 changed files with 53 additions and 211 deletions

View File

@@ -44,21 +44,7 @@ type State struct {
func testPreStop(c clientset.Interface, ns string) {
// This is the server that will receive the preStop notification
podDescr := &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "server",
},
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Name: "server",
Image: imageutils.GetE2EImage(imageutils.Agnhost),
Args: []string{"nettest"},
Ports: []v1.ContainerPort{{ContainerPort: 8080}},
},
},
},
}
podDescr := e2epod.NewAgnhostPod(ns, "server", nil, nil, []v1.ContainerPort{{ContainerPort: 8080}}, "nettest")
ginkgo.By(fmt.Sprintf("Creating server pod %s in namespace %s", podDescr.Name, ns))
podDescr, err := c.CoreV1().Pods(ns).Create(context.TODO(), podDescr, metav1.CreateOptions{})
framework.ExpectNoError(err, fmt.Sprintf("creating pod %s", podDescr.Name))