Skip to content

Commit

Permalink
Enable traceflow e2e test on Windows
Browse files Browse the repository at this point in the history
Signed-off-by: gran <gran@vmware.com>
  • Loading branch information
gran-vmv committed May 5, 2022
1 parent 8f451f7 commit 2ef2ef6
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 92 deletions.
3 changes: 3 additions & 0 deletions pkg/agent/openflow/client_test.go
Expand Up @@ -367,6 +367,7 @@ func Test_client_SendTraceflowPacket(t *testing.T) {
name: "IPv6 ICMPv6",
args: args{
Packet: binding.Packet{
IsIPv6: true,
SourceMAC: srcMAC,
DestinationMAC: dstMAC,
SourceIP: net.ParseIP("1111::4444"),
Expand All @@ -381,6 +382,7 @@ func Test_client_SendTraceflowPacket(t *testing.T) {
name: "IPv6 TCP",
args: args{
Packet: binding.Packet{
IsIPv6: true,
SourceMAC: srcMAC,
DestinationMAC: dstMAC,
SourceIP: net.ParseIP("1111::4444"),
Expand All @@ -394,6 +396,7 @@ func Test_client_SendTraceflowPacket(t *testing.T) {
name: "IPv6 UDP",
args: args{
Packet: binding.Packet{
IsIPv6: true,
SourceMAC: srcMAC,
DestinationMAC: dstMAC,
SourceIP: net.ParseIP("1111::4444"),
Expand Down
18 changes: 15 additions & 3 deletions test/e2e/fixtures.go
Expand Up @@ -437,6 +437,18 @@ func deletePodWrapper(tb testing.TB, data *TestData, namespace, name string) {
// created Pods. Pods are created in parallel to reduce the time required to run the tests.
func createTestBusyboxPods(tb testing.TB, data *TestData, num int, ns string, nodeName string) (
podNames []string, podIPs []*PodIPs, cleanupFn func(),
) {
return createTestPods(tb, data, num, ns, nodeName, data.createBusyboxPodOnNode)
}

func createTestAgnhostPods(tb testing.TB, data *TestData, num int, ns string, nodeName string) (
podNames []string, podIPs []*PodIPs, cleanupFn func(),
) {
return createTestPods(tb, data, num, ns, nodeName, data.createAgnhostPodOnNode)
}

func createTestPods(tb testing.TB, data *TestData, num int, ns string, nodeName string, createFunc func(string, string, string, bool) error) (
podNames []string, podIPs []*PodIPs, cleanupFn func(),
) {
cleanupFn = func() {
var wg sync.WaitGroup
Expand All @@ -458,9 +470,9 @@ func createTestBusyboxPods(tb testing.TB, data *TestData, num int, ns string, no

createPodAndGetIP := func() (string, *PodIPs, error) {
podName := randName("test-pod-")
tb.Logf("Creating a busybox test Pod '%s' and waiting for IP", podName)
if err := data.createBusyboxPodOnNode(podName, ns, nodeName, false); err != nil {
tb.Errorf("Error when creating busybox test Pod '%s': %v", podName, err)
tb.Logf("Creating a test Pod '%s' and waiting for IP", podName)
if err := createFunc(podName, ns, nodeName, false); err != nil {
tb.Errorf("Error when creating test Pod '%s': %v", podName, err)
return "", nil, err
}
podIP, err := data.podWaitForIPs(defaultTimeout, podName, ns)
Expand Down

0 comments on commit 2ef2ef6

Please sign in to comment.