Skip to content

Commit

Permalink
Use k8s client to get logs
Browse files Browse the repository at this point in the history
Signed-off-by: Yun-Tang Hsu <hsuy@vmware.com>
  • Loading branch information
yuntanghsu committed Dec 8, 2023
1 parent e6d0c50 commit 420021e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/e2e/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func setupTestForFlowAggregator(tb testing.TB, o flowVisibilityTestOptions) (*Te
if err := NewPodBuilder("ipfix-collector", testData.testNamespace, ipfixCollectorImage).InHostNetwork().Create(testData); err != nil {
tb.Errorf("Error when creating the ipfix collector Pod: %v", err)
}
ipfixCollectorIP, err := testData.podWaitForIPs(defaultTimeout, "ipfix-collector", testData.testNamespace)
ipfixCollectorIP, err := testData.podWaitForIPs(defaultTimeout, ipfixPodName, testData.testNamespace)
if err != nil || len(ipfixCollectorIP.IPStrings) == 0 {
tb.Errorf("Error when waiting to get ipfix collector Pod IP: %v", err)
return nil, v4Enabled, v6Enabled, err
Expand Down
8 changes: 3 additions & 5 deletions test/e2e/flowaggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1407,12 +1407,10 @@ func getCollectorOutput(t *testing.T, srcIP, dstIP, srcPort string, isDstService
// In the ToExternalFlows test, flow record will arrive 5.5s (exporterActiveFlowExportTimeout+aggregatorActiveFlowRecordTimeout) after executing wget command
// We set the timeout to 9s (5.5s plus one more aggregatorActiveFlowRecordTimeout) to make the ToExternalFlows test more stable
err := wait.PollImmediate(defaultInterval, defaultTimeout, func() (bool, error) {
var rc int
var err error
// `pod-running-timeout` option is added to cover scenarios where ipfix flow-collector has crashed after being deployed
rc, collectorOutput, _, err = data.RunCommandOnNode(controlPlaneNodeName(), fmt.Sprintf("kubectl logs --pod-running-timeout=%v ipfix-collector -n %s", aggregatorInactiveFlowRecordTimeout.String(), data.testNamespace))
if err != nil || rc != 0 {
return false, err
collectorOutput, err = data.GetPodLogs(context.TODO(), data.testNamespace, ipfixPodName, "")
if err != nil {
return false, nil
}

// Checking that all the data records which correspond to the iperf flow are received
Expand Down
1 change: 1 addition & 0 deletions test/e2e/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const (
toolboxImage = "projects.registry.vmware.com/antrea/toolbox:1.2-1"
ipfixCollectorImage = "projects.registry.vmware.com/antrea/ipfix-collector:v0.6.2"
ipfixCollectorPort = "4739"
ipfixPodName = "ipfix-collector"
clickHouseHTTPPort = "8123"

nginxLBService = "nginx-loadbalancer"
Expand Down

0 comments on commit 420021e

Please sign in to comment.