Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Hang Yan <yhang@vmware.com>
  • Loading branch information
hangyan committed Feb 23, 2024
1 parent b6dd887 commit 3a19e85
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/e2e/packetsampling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (
psNamespace = "default"
psSecretName = "ps-secret"
psNginxPodName = "test-nginx"
psBusyboxPodName = "busybox"
psToolboxPodName = "toolbox"
mixProtoServerPodName = "mix-proto-server"
serverPort int32 = 8080
)
Expand Down Expand Up @@ -110,7 +110,7 @@ func testPacketSamplingIntraNode(t *testing.T, data *TestData) {
require.NoError(t, err)
defer deletePodWrapper(t, data, data.testNamespace, mixProtoServerPodName)

err = data.createBusyboxPodOnNode(psBusyboxPodName, data.testNamespace, node1, false)
err = data.createToolboxPodOnNode(psToolboxPodName, data.testNamespace, node1, false)
require.NoError(t, err)
defer deletePodWrapper(t, data, data.testNamespace, psNginxPodName)

Expand All @@ -122,15 +122,15 @@ func testPacketSamplingIntraNode(t *testing.T, data *TestData) {
{
name: "intraNodePacketSamplingIPv4",
ipVersion: 4,
srcPod: psBusyboxPodName,
srcPod: psToolboxPodName,
ps: &crdv1alpha1.PacketSampling{
ObjectMeta: metav1.ObjectMeta{
Name: randName(fmt.Sprintf("%s-%s-to-%s-%s-", data.testNamespace, node1Pods[0], data.testNamespace, node1Pods[1])),
},
Spec: crdv1alpha1.PacketSamplingSpec{
Source: crdv1alpha1.Source{
Namespace: data.testNamespace,
Pod: psBusyboxPodName,
Pod: psToolboxPodName,
},
Destination: crdv1alpha1.Destination{
Namespace: data.testNamespace,
Expand Down Expand Up @@ -168,15 +168,15 @@ func testPacketSamplingIntraNode(t *testing.T, data *TestData) {
{
name: "intraNodeUDPPacketSamplingIPv4",
ipVersion: 4,
srcPod: psBusyboxPodName,
srcPod: psToolboxPodName,
ps: &crdv1alpha1.PacketSampling{
ObjectMeta: metav1.ObjectMeta{
Name: randName(fmt.Sprintf("%s-%s-to-%s-%s-", data.testNamespace, node1Pods[0], data.testNamespace, node1Pods[1])),
},
Spec: crdv1alpha1.PacketSamplingSpec{
Source: crdv1alpha1.Source{
Namespace: data.testNamespace,
Pod: psBusyboxPodName,
Pod: psToolboxPodName,
},
Destination: crdv1alpha1.Destination{
Namespace: data.testNamespace,
Expand Down Expand Up @@ -278,12 +278,12 @@ func runPacketSamplingTest(t *testing.T, data *TestData, tc psTestCase) {
}
} else if protocol == protocolTCP {
url := fmt.Sprintf("%s:%v", server, tc.ps.Spec.Packet.TransportHeader.TCP.DstPort)
if _, _, err := data.runWgetCommandOnBusyboxWithRetry(tc.srcPod, data.testNamespace, url, 3); err != nil {
if _, _, err := data.runWgetCommandOnToolboxWithRetry(tc.srcPod, data.testNamespace, url, 3); err != nil {
t.Logf("wget '%s' -> '%v' failed: ERROR (%v)", srcPod, url, err)
}
} else if protocol == protocolUDP {
for i := 1; i <= 5; i++ {
if err := data.runNetcatCommandFromTestPodWithProtocol(tc.srcPod, data.testNamespace, busyboxContainerName, server, serverPort, "udp"); err != nil {
if err := data.runNetcatCommandFromTestPodWithProtocol(tc.srcPod, data.testNamespace, toolboxContainerName, server, serverPort, "udp"); err != nil {
t.Logf("Netcat(UDP) '%s' -> '%v' failed: ERROR (%v)", srcPod, server, err)
}
}
Expand Down

0 comments on commit 3a19e85

Please sign in to comment.