Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Qiyue Yao <[email protected]>
  • Loading branch information
qiyueyao committed May 8, 2024
1 parent 92cdfae commit 6a1be4d
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions test/e2e/l7networkpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"

crdv1beta1 "antrea.io/antrea/pkg/apis/crd/v1beta1"
agentconfig "antrea.io/antrea/pkg/config/agent"
Expand Down Expand Up @@ -389,13 +388,9 @@ func checkL7LoggingResult(t *testing.T, data *TestData, nodeName string, matcher
require.NoError(t, err, "Error occurred when trying to get the Antrea Agent Pod running on Node %s", nodeName)
cmd := []string{"cat", l7LogFile}

if err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 10*time.Second, false, func(ctx context.Context) (bool, error) {
assert.EventuallyWithT(t, func(c *assert.CollectT) {
stdout, stderr, err := data.RunCommandFromPod(antreaNamespace, antreaPodName, "antrea-agent", cmd)
if err != nil || stderr != "" {
// file may not exist yet
t.Logf("Error when printing the audit log file, err: %v, stderr: %v", err, stderr)
return false, nil
}
assert.NoError(t, err, "Error when printing the audit log file, stderr: %v", stderr)

var gotLogs []L7LogEntry
dec := json.NewDecoder(strings.NewReader(stdout))
Expand All @@ -407,8 +402,5 @@ func checkL7LoggingResult(t *testing.T, data *TestData, nodeName string, matcher
}
}
assert.ElementsMatch(t, gotLogs, matchers)
return true, nil
}); err != nil {
t.Errorf("Error when polling l7 log files for required entries: %v", err)
}
}, 10*time.Second, 1*time.Second)
}

0 comments on commit 6a1be4d

Please sign in to comment.