Skip to content

Commit

Permalink
improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Feb 9, 2025
1 parent 44caedd commit 19121fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions testdata/test_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ RNAME="${FILE_PREFIX}_base.read.txt"


function test_ptcpdump() {
timeout 60s ${CMD} -c 1 -v -i any ${PTCPDUMP_EXTRA_ARGS} --print -w "${FNAME}" \
'dst host 1.1.1.1 and tcp[tcpflags] = tcp-syn' | tee "${LNAME}" &
sleep 40
timeout 30s ${CMD} -c 1 -v -i any ${PTCPDUMP_EXTRA_ARGS} --print -w "${FNAME}" \
'dst host 1.1.1.1' | tee "${LNAME}" &
sleep 10
curl -m 10 1.1.1.1 &>/dev/null || true
wait

cat "${LNAME}"
cat "${LNAME}" | grep '/usr/bin/curl'
cat "${LNAME}" | grep -F ' > 1.1.1.1.80: Flags [S],' # SYN
cat "${LNAME}" | grep -F ' > 1.1.1.1.80: Flags'
}

function test_tcpdump_read() {
Expand Down
4 changes: 2 additions & 2 deletions testdata/test_parent_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ RNAME="${FILE_PREFIX}_parent_info.read.txt"

function test_ptcpdump() {
timeout 30s ${CMD} -c 1 ${PTCPDUMP_EXTRA_ARGS} -v -i any --print -w "${FNAME}" \
'dst host 1.1.1.1 and tcp[tcpflags] = tcp-syn' | tee "${LNAME}" &
'dst host 1.1.1.1' | tee "${LNAME}" &
sleep 10
curl -m 10 1.1.1.1 &>/dev/null || true
wait

cat "${LNAME}"
cat "${LNAME}" | grep '/usr/bin/curl'
cat "${LNAME}" | grep 'ParentProc'
cat "${LNAME}" | grep -F ' > 1.1.1.1.80: Flags [S],' # SYN
cat "${LNAME}" | grep -F ' > 1.1.1.1.80: Flags'
}


Expand Down
4 changes: 2 additions & 2 deletions testdata/test_run_with_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export TMP="/tmp/"

function test_ptcpdump() {
timeout 60s ${CMD} -c 1 -v -i any ${PTCPDUMP_EXTRA_ARGS} --print -w "${FNAME}" \
'dst host 1.1.1.1 and tcp[tcpflags] = tcp-syn' | tee "${LNAME}" &
'dst host 1.1.1.1' | tee "${LNAME}" &
sleep 30
curl -m 10 1.1.1.1 &>/dev/null || true
wait

cat "${LNAME}"
cat "${LNAME}" | grep '/usr/bin/curl'
cat "${LNAME}" | grep -F 'curl -m 10 1.1.1.1'
cat "${LNAME}" | grep -F ' > 1.1.1.1.80: Flags [S],' # SYN
cat "${LNAME}" | grep -F ' > 1.1.1.1.80: Flags'
}

function test_ptcpdump_read() {
Expand Down

0 comments on commit 19121fa

Please sign in to comment.