Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ceclinux committed Jul 4, 2022
1 parent 1ba767f commit a35a87e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ci/jenkins/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ function run_e2e {
if [[ $TESTBED_TYPE == "flexible-ipam" ]]; then
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus --antrea-ipam
else
go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus
go test -run=TestMulticast -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus
fi
if [[ "$?" != "0" ]]; then
TEST_FAILURE=true
Expand Down
9 changes: 7 additions & 2 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ import (
"os"
"path/filepath"
"reflect"
"regexp"

"k8s.io/klog/v2"
"strconv"
"strings"
"time"

"regexp"
"github.com/containernetworking/plugins/pkg/ip"
log "github.com/sirupsen/logrus"
"golang.org/x/mod/semver"
Expand Down Expand Up @@ -2165,7 +2167,10 @@ func (data *TestData) GetMulticastInterfaces(antreaNamespace string) ([]string,
}

func GetTransportInterface(data *TestData) (string, error) {
_, transportInterfaceUntrimmed, _, err := data.RunCommandOnNode(nodeName(0), fmt.Sprintf("/bin/sh -c ip -br addr show | grep %s | awk '{split($1,a,\"@\"); print a[1]}'", clusterInfo.nodes[0].ipv4Addr))
a, transportInterfaceUntrimmed, b, err := data.RunCommandOnNode(nodeName(0), fmt.Sprintf("/bin/sh -c 'ls /sys/class/net | grep %s'", clusterInfo.nodes[0].ipv4Addr))
klog.Infof("%+v", a)
klog.Infof("%+v", b)
klog.Infof("%+v", err)
if err != nil {
return "", err
}
Expand Down
11 changes: 8 additions & 3 deletions test/e2e/multicast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ func runTestMulticastBetweenPods(t *testing.T, data *TestData, mc multicastTestc
if err := wait.Poll(3*time.Second, defaultTimeout, func() (bool, error) {
if !senderReady {
// Sender pods should add an outbound multicast route except running as HostNetwork.
_, mrouteResult, _, err := data.RunCommandOnNode(nodeName(mc.senderConfig.nodeIdx), fmt.Sprintf("/bin/sh -c ip mroute show iif %s |grep ',%s)'|grep '%s'", gatewayInterface, mc.group.String(), strings.Join(nodeMulticastInterfaces[mc.senderConfig.nodeIdx], " ")))
_, mrouteResult, _, err := data.RunCommandOnNode(nodeName(mc.senderConfig.nodeIdx), fmt.Sprintf("/bin/sh -c 'ip mroute show iif %s |grep ',%s)'|grep '%s''", gatewayInterface, mc.group.String(), strings.Join(nodeMulticastInterfaces[mc.senderConfig.nodeIdx], " ")))
if err != nil {
return false, err
}
Expand All @@ -601,7 +601,7 @@ func runTestMulticastBetweenPods(t *testing.T, data *TestData, mc multicastTestc
continue
}
for _, receiverMulticastInterface := range nodeMulticastInterfaces[receiver.nodeIdx] {
_, mRouteResult, _, err := data.RunCommandOnNode(nodeName(receiver.nodeIdx), fmt.Sprintf("/bin/sh -c ip mroute show iif %s|grep ',%s)'", receiverMulticastInterface, mc.group.String()))
_, mRouteResult, _, err := data.RunCommandOnNode(nodeName(receiver.nodeIdx), fmt.Sprintf("/bin/sh -c 'ip mroute show iif %s|grep ',%s)''", receiverMulticastInterface, mc.group.String()))
if err != nil {
return false, err
}
Expand All @@ -616,7 +616,7 @@ func runTestMulticastBetweenPods(t *testing.T, data *TestData, mc multicastTestc
return false, nil
}
}
_, mAddrResult, _, err := data.RunCommandOnNode(nodeName(receiver.nodeIdx), fmt.Sprintf("/bin/sh -c ip maddr show %s | grep %s", receiverMulticastInterface, mc.group.String()))
_, mAddrResult, _, err := data.RunCommandOnNode(nodeName(receiver.nodeIdx), fmt.Sprintf("/bin/sh -c 'ip maddr show %s | grep %s'", receiverMulticastInterface, mc.group.String()))
if err != nil {
return false, err
}
Expand Down Expand Up @@ -675,6 +675,7 @@ func computeMulticastInterfaces(t *testing.T, data *TestData) (map[int][]string,
return nil, err
}
transportInterface, err := GetTransportInterface(data)
t.Logf("%+v", transportInterface)
if err != nil {
t.Fatalf("Error getting transport interfaces: %v", err)
}
Expand All @@ -686,9 +687,13 @@ func computeMulticastInterfaces(t *testing.T, data *TestData) (map[int][]string,
}
// The final multicast interfaces used for the node is calculated by (localInterfacesSet intersects multicastInterfaceSet adds transportInterface).
localInterfacesSet := sets.NewString(strings.Split(strings.TrimSpace(localInterfacesStr), "\n")...)
t.Logf("%+v", localInterfacesSet)
multicastInterfaceSet := sets.NewString(multicastInterfaces...)
t.Logf("%+v", multicastInterfaceSet)
externalMulticastInterfaces := localInterfacesSet.Intersection(multicastInterfaceSet)
t.Logf("%+v", externalMulticastInterfaces)
currNodeMulticastInterfaces := externalMulticastInterfaces.Insert(transportInterface).List()
t.Logf("%+v", currNodeMulticastInterfaces)
t.Logf("Multicast interfaces for node index %d is %+v", nodeIdx, currNodeMulticastInterfaces)
nodeMulticastInterfaces[nodeIdx] = currNodeMulticastInterfaces
}
Expand Down

0 comments on commit a35a87e

Please sign in to comment.