Skip to content

Commit e32620a

Browse files
E2E: renaming and using existing tools instead of custom code
Signed-off-by: Martin Kennelly <[email protected]>
1 parent 3f446a1 commit e32620a

File tree

7 files changed

+23
-22
lines changed

7 files changed

+23
-22
lines changed

test/e2e/e2e.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,9 +2200,7 @@ var _ = ginkgo.Describe("e2e delete databases", func() {
22002200
framework.ExpectNoError(<-errChan)
22012201
}
22022202

2203-
twoPodsContinuousConnectivityTest := func(f *framework.Framework,
2204-
node1Name string, node2Name string,
2205-
syncChan chan string, errChan chan error) {
2203+
twoPodsContinuousConnectivityTest := func(f *framework.Framework, node1Name string, node2Name string, syncChan chan string, errChan chan error) {
22062204
const (
22072205
pod1Name string = "connectivity-test-pod1"
22082206
pod2Name string = "connectivity-test-pod2"
@@ -2219,7 +2217,8 @@ var _ = ginkgo.Describe("e2e delete databases", func() {
22192217

22202218
ginkgo.By("Checking initial connectivity from one pod to the other and verifying that the connection is achieved")
22212219

2222-
stdout, err := e2ekubectl.RunKubectl(f.Namespace.Name, "exec", pod1Name, "--", "curl", fmt.Sprintf("%s/hostname", net.JoinHostPort(pod2IP, "8080")))
2220+
stdout, err := e2ekubectl.RunKubectl(f.Namespace.Name, "exec", pod1Name, "--", "curl", fmt.Sprintf("%s/hostname",
2221+
net.JoinHostPort(pod2IP, fmt.Sprintf("%d", podPort))))
22232222

22242223
if err != nil || stdout != pod2Name {
22252224
errChan <- fmt.Errorf("Error: attempted connection to pod %s found err: %v", pod2Name, err)
@@ -2234,7 +2233,8 @@ var _ = ginkgo.Describe("e2e delete databases", func() {
22342233
framework.Logf(msg + ": finish connectivity test.")
22352234
break L
22362235
default:
2237-
stdout, err := e2ekubectl.RunKubectl(f.Namespace.Name, "exec", pod1Name, "--", "curl", fmt.Sprintf("%s/hostname", net.JoinHostPort(pod2IP, "8080")))
2236+
stdout, err := e2ekubectl.RunKubectl(f.Namespace.Name, "exec", pod1Name, "--", "curl", fmt.Sprintf("%s/hostname",
2237+
net.JoinHostPort(pod2IP, fmt.Sprintf("%d", podPort))))
22382238
if err != nil || stdout != pod2Name {
22392239
errChan <- err
22402240
framework.Failf("Error: attempted connection to pod %s found err: %v", pod2Name, err)

test/e2e/egressip.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ var _ = ginkgo.DescribeTableSubtree("e2e egress IP validation", func(netConfigPa
411411

412412
targetPodAndTest := func(namespace, fromName, toName, toIP string, toPort uint16) wait.ConditionFunc {
413413
return func() (bool, error) {
414-
dstPortStr := fmt.Sprintf("%d", toPort)
415-
stdout, err := e2ekubectl.RunKubectl(namespace, "exec", fromName, "--", "curl", "--connect-timeout", "2",
416-
fmt.Sprintf("%s/hostname", net.JoinHostPort(toIP, dstPortStr)))
414+
stdout, err := e2ekubectl.RunKubectl(namespace, "exec", fromName, "--",
415+
"curl", "--connect-timeout", "2", fmt.Sprintf("%s/hostname",
416+
net.JoinHostPort(toIP, fmt.Sprintf("%d", toPort))))
417417
if err != nil || stdout != toName {
418418
framework.Logf("Error: attempted connection to pod %s found err: %v", toName, err)
419419
return false, nil
@@ -427,7 +427,7 @@ var _ = ginkgo.DescribeTableSubtree("e2e egress IP validation", func(netConfigPa
427427
for _, podName := range podNames {
428428
_, err := e2ekubectl.RunKubectl(namespace, "exec", podName, "--", "curl", "--connect-timeout", "2", "-k", destination)
429429
if err != nil {
430-
framework.Logf("Error: attempted connection to API server found err: %v", err)
430+
framework.Logf("Error: attempted connection to destination %s failed, found err: %v", destination, err)
431431
return false, nil
432432
}
433433
}

test/e2e/network_segmentation_services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var _ = Describe("Network Segmentation: services", func() {
4242
serviceTargetPort = 80
4343
userDefinedNetworkIPv4Subnet = "10.128.0.0/16"
4444
userDefinedNetworkIPv6Subnet = "2014:100:200::0/60"
45-
clientContainer = "frr"
45+
clientContainerName = "frr"
4646
)
4747

4848
var (

test/e2e/service.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,11 +2247,13 @@ spec:
22472247
if err := os.WriteFile("egressip.yaml", []byte(egressIPConfig), 0644); err != nil {
22482248
framework.Failf("Unable to write CRD config to disk: %v", err)
22492249
}
2250-
defer func() {
2250+
ginkgo.DeferCleanup(func() error {
2251+
e2ekubectl.RunKubectlOrDie("default", "delete", "-f", "egressip.yaml", "--ignore-not-found=true")
22512252
if err := os.Remove("egressip.yaml"); err != nil {
2252-
framework.Logf("Unable to remove the CRD config from disk: %v", err)
2253+
return fmt.Errorf("unable to remove the CRD config from disk: %v", err)
22532254
}
2254-
}()
2255+
return nil
2256+
})
22552257

22562258
framework.Logf("Create the EgressIP configuration")
22572259
e2ekubectl.RunKubectlOrDie("default", "create", "-f", "egressip.yaml")
@@ -2289,7 +2291,7 @@ spec:
22892291
} else if strings.Count(targetPodLogs, lbClientIPv6) >= 2 {
22902292
framework.Logf("found the expected srcIP %s!", lbClientIPv6)
22912293
} else {
2292-
framework.Failf("could not get expected srcIP!")
2294+
framework.Failf("could not get expected srcIP!, target pod logs:\n%q", targetPodLogs)
22932295
}
22942296
})
22952297
})

test/e2e/static_pods.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ var _ = ginkgo.Describe("Creating a static pod on a node", func() {
9797
nodeName := nodes.Items[0].Name
9898
podName := fmt.Sprintf("static-pod-%s", nodeName)
9999

100-
ginkgo.By("copying a pod.yaml file into the /etc/kubernetes/manifests dir of a node")
101-
framework.Logf("creating %s on node %s", podName, nodeName)
100+
ginkgo.By("creating static pod file")
101+
102102
var staticPodYaml = fmt.Sprintf(`apiVersion: v1
103103
kind: Pod
104104
metadata:
@@ -111,12 +111,12 @@ spec:
111111
command: ["/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait"]
112112
`, f.Namespace.Name, images.AgnHost())
113113
createStaticPod(f, nodeName, staticPodYaml)
114-
err = waitForPodRunningInNamespaceTimeout(f.ClientSet, podName, f.Namespace.Name, time.Second*30)
114+
err = waitForPodRunningInNamespaceTimeout(f.ClientSet, podName, f.Namespace.Name, time.Second*60)
115115
gomega.Expect(err).NotTo(gomega.HaveOccurred())
116116
ginkgo.By("Removing the pod file from the nodes /etc/kubernetes/manifests")
117117
framework.Logf("Removing %s from %s", podName, nodeName)
118118
removeStaticPodFile(nodeName, podFile)
119-
err = e2epod.WaitForPodNotFoundInNamespace(context.TODO(), f.ClientSet, podName, f.Namespace.Name, time.Second*30)
119+
err = e2epod.WaitForPodNotFoundInNamespace(context.TODO(), f.ClientSet, podName, f.Namespace.Name, time.Second*60)
120120
gomega.Expect(err).NotTo(gomega.HaveOccurred())
121121
})
122122
})

test/e2e/status_manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ func checkEgressFirewallStatus(namespace string, empty bool, success bool, event
113113
return empty && output == "" || success && strings.Contains(output, "EgressFirewall Rules applied")
114114
}
115115
if eventually {
116-
gomega.Eventually(checkStatus, 1*time.Second, 100*time.Millisecond).Should(gomega.BeTrue())
116+
gomega.Eventually(checkStatus, 5*time.Second, 100*time.Millisecond).Should(gomega.BeTrue())
117117
} else {
118-
gomega.Consistently(checkStatus, 1*time.Second, 100*time.Millisecond).Should(gomega.BeTrue())
118+
gomega.Consistently(checkStatus, 5*time.Second, 100*time.Millisecond).Should(gomega.BeTrue())
119119
}
120120
}

test/e2e/util.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"math/rand"
88
"net"
99
"os"
10-
"os/exec"
1110
"regexp"
1211
"strconv"
1312
"strings"
@@ -1409,7 +1408,7 @@ func waitForPodNotFoundInNamespace(ctx context.Context, c clientset.Interface, p
14091408
}
14101409

14111410
func isDefaultNetworkAdvertised() bool {
1412-
podNetworkValue, err := exec.Command("kubectl", "get", "ra", "default", "--template={{index .spec.advertisements 0}}").CombinedOutput()
1411+
podNetworkValue, err := e2ekubectl.RunKubectl("default", "get", "ra", "default", "--template={{index .spec.advertisements 0}}")
14131412
if err != nil {
14141413
return false
14151414
}

0 commit comments

Comments
 (0)