Skip to content

Commit

Permalink
use test.Tempdir
Browse files Browse the repository at this point in the history
Signed-off-by: Hang Yan <[email protected]>
  • Loading branch information
hangyan committed Nov 20, 2024
1 parent 3aa9bc1 commit d44f261
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/e2e/packetcapture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,10 @@ func runPacketCaptureTest(t *testing.T, data *TestData, tc pcTestCase) {
antreaPodName, err := data.getAntreaPodOnNode(nodeName(0))
require.NoError(t, err)
fileName := fmt.Sprintf("%s.pcapng", tc.pc.Name)
dstFileName := filepath.Join(t.TempDir(), fileName)
tmpDir := t.TempDir()
dstFileName := filepath.Join(tmpDir, fileName)
packetFile := filepath.Join("/tmp", "antrea", "packetcapture", "packets", fileName)
require.NoError(t, data.copyPodFiles(antreaPodName, "antrea-agent", "kube-system", packetFile, os.TempDir()))
require.NoError(t, data.copyPodFiles(antreaPodName, "antrea-agent", "kube-system", packetFile, tmpDir))
defer os.Remove(dstFileName)
file, err := os.Open(dstFileName)
require.NoError(t, err)
Expand Down

0 comments on commit d44f261

Please sign in to comment.