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

tests: fix flaky ja4 test #5169

Merged
merged 1 commit into from
Mar 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tests/unit/s2n_fingerprint_ja4_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ static S2N_RESULT s2n_test_ja4_hash_from_cipher_count(uint16_t cipher_count,
};
RESULT_GUARD_POSIX(s2n_stuffer_write_bytes(&bytes, before_ciphers, sizeof(before_ciphers)));

size_t ciphers_size = cipher_count * S2N_TLS_CIPHER_SUITE_LEN;
size_t ciphers_size = cipher_count * sizeof(uint16_t);
RESULT_GUARD_POSIX(s2n_stuffer_write_uint16(&bytes, ciphers_size));
RESULT_GUARD_POSIX(s2n_stuffer_skip_write(&bytes, ciphers_size));
for (size_t i = 0; i < cipher_count; i++) {
RESULT_GUARD_POSIX(s2n_stuffer_write_uint16(&bytes, 0));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I agree this is more correct. If you're worried about the test still being flaky you could always add a debugging print statement if the test fails.

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'm leaning towards only doing that if this doesn't work. I'm pretty confident this will work.


uint8_t after_ciphers[] = {
S2N_TEST_CLIENT_HELLO_AFTER_CIPHERS,
Expand Down
Loading