Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: introduce a script to test flag --comm #222

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spencercjh
Copy link
Contributor

CLOSE #212

Copy link

vercel bot commented Dec 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
kyanos ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 27, 2024 9:48am

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 27, 2024
@spencercjh spencercjh changed the title test: introduce test_filter_by_comm.sh to test flag --comm test: introduce a script to test flag --comm Dec 27, 2024
@dosubot dosubot bot added the unittest label Dec 27, 2024
@spencercjh spencercjh marked this pull request as draft December 27, 2024 08:59
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
. $(dirname "$0")/common.sh
set -ex

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not adding -o pipefail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied these scaffold codes from other steps. I'm not sure what the side effects of changing the set option would be.

Copy link
Owner

@hengyoush hengyoush Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use this set -euxo pipefail. It should has no side effects .

@spencercjh spencercjh marked this pull request as ready for review December 27, 2024 09:55
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Dec 27, 2024
@hengyoush
Copy link
Owner

HTTPS may require sending more than two requests over a long connection to be correctly captured 😂.
Can this test be simplified by using curl to request any website (via http), and then using --comm curl? Finally check, when grepping, filter for the domain name (e.g., if curl requests baidu, grep for baidu.com).

What do you think? @spencercjh

curl --insecure https://127.0.0.1:4443 &>/dev/null || true
wait

cat "${AFTER_LNAME}" | grep "127.0.0.1:4443"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filtering by ip:port alone may not be accurate, as only the final request and response being printed can be considered successful. I think we can filter by some request info like domain.

pip install --break-system-packages ssl || true

# server start before kyanos
timeout 40 python3 ./testdata/start_https_server.py &
Copy link
Owner

@hengyoush hengyoush Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, using HTTP might be more appropriate. I misled you in the issue.

@spencercjh
Copy link
Contributor Author

HTTPS may require sending more than two requests over a long connection to be correctly captured 😂.

Can this test be simplified by using curl to request any website (via http), and then using --comm curl? Finally check, when grepping, filter for the domain name (e.g., if curl requests baidu, grep for baidu.com).

What do you think? @spencercjh

OK 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files. unittest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an e2e test to verify the --comm option works fine
3 participants