Skip to content

Make HPACK encoding test deterministic - #1036

Open
sainadh777 wants to merge 1 commit into
apache:mainfrom
sainadh777:codex/make-hpack-test-deterministic
Open

Make HPACK encoding test deterministic#1036
sainadh777 wants to merge 1 commit into
apache:mainfrom
sainadh777:codex/make-hpack-test-deterministic

Conversation

@sainadh777

Copy link
Copy Markdown
Contributor

Summary

  • allow package-local injection of the HPACK header encoding policy
  • make TestHpack.testEncode() explicitly force Huffman encoding
  • remove the checked-in TODO and the test's dependency on the default length heuristic

Rationale

TestHpack.testEncode() asserts a 27-byte encoded result, which assumes Huffman encoding. The default encoder currently chooses Huffman encoding for values longer than five characters, but that heuristic may change. This implements the guidance in TODO.md by making the test select Huffman encoding directly.

The default constructor still uses DEFAULT_HEADER_FUNCTION, so production behavior is unchanged. The new constructor and the exposed nested interface remain package-private.

Verification

  • ant test -Dtest.entry=org.apache.coyote.http2.TestHpack -Dtest.silent=true
  • ant -Dexecute.validate=true validate
  • complete unfiltered suite on Linux/JDK 21: ant test -Dtest.silent=true -Dtest.threads=4 -Dtest.openssl.path=/usr/bin/openssl
  • clean source build: ant clean, then ant
  • runtime smoke: started the generated distribution, received HTTP 200 from http://127.0.0.1:8080/, and stopped Tomcat cleanly

@sainadh777
sainadh777 marked this pull request as ready for review August 5, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant