envoy icon indicating copy to clipboard operation
envoy copied to clipboard

Deduplicate and fix header validator unit tests

Open Winbobob opened this issue 1 year ago • 10 comments

Commit Message: Deduplicate and fix header validator unit tests Additional Description: N/A Risk Level: Low Testing: Unit tests Docs Changes: Release Notes: Platform Specific Features:

Winbobob avatar Aug 15 '24 06:08 Winbobob

/assign @yanavlasov

adisuissa avatar Aug 15 '24 14:08 adisuissa

These are not the same tests. The HttpConnectionManagerImplTest test validates integration of UHV with HCM, while the Http2HeaderValidatorTest validates logic in the default HTTP/2 header validator.

/wait-any

yanavlasov avatar Aug 15 '24 17:08 yanavlasov

These are not the same tests. The HttpConnectionManagerImplTest test validates integration of UHV with HCM, while the Http2HeaderValidatorTest validates logic in the default HTTP/2 header validator.

/wait-any

Yeah, I agree that HttpConnectionManagerImplTest and Http2HeaderValidatorTest are different test suites. However, there are duplicated tests within each test suite.

Winbobob avatar Aug 15 '24 18:08 Winbobob

These are not the same tests. The HttpConnectionManagerImplTest test validates integration of UHV with HCM, while the Http2HeaderValidatorTest validates logic in the default HTTP/2 header validator. /wait-any

Yeah, I agree that HttpConnectionManagerImplTest and Http2HeaderValidatorTest are different test suites. However, there are duplicated tests within each test suite.

They test very different things. One tests interaction between HCM and UHV using mock UHV, the other tests real (default) UHV validation of trailers.

yanavlasov avatar Aug 15 '24 18:08 yanavlasov

These are not the same tests. The HttpConnectionManagerImplTest test validates integration of UHV with HCM, while the Http2HeaderValidatorTest validates logic in the default HTTP/2 header validator. /wait-any

Yeah, I agree that HttpConnectionManagerImplTest and Http2HeaderValidatorTest are different test suites. However, there are duplicated tests within each test suite.

They test very different things. One tests interaction between HCM and UHV using mock UHV, the other tests real (default) UHV validation of trailers.

Sorry, trying to make sure we are on the same page. Do you think below two tests are the same?

  • https://github.com/envoyproxy/envoy/blob/40dddc9ee82e63ef06903efac822a08e031473b6/test/common/http/conn_manager_impl_test_2.cc#L3827
  • https://github.com/envoyproxy/envoy/blob/40dddc9ee82e63ef06903efac822a08e031473b6/test/common/http/conn_manager_impl_test_2.cc#L3881

Winbobob avatar Aug 15 '24 18:08 Winbobob

  • HeaderValidatorFailTrailersTransformationBeforeResponse

These do look like the same test.

yanavlasov avatar Aug 19 '24 18:08 yanavlasov

/wait-any

yanavlasov avatar Aug 19 '24 18:08 yanavlasov

  • HeaderValidatorFailTrailersTransformationBeforeResponse

These do look like the same test.

Thank you for the confirmation! And I removed the 2nd test case in this PR.

Winbobob avatar Aug 19 '24 18:08 Winbobob

Also, https://github.com/envoyproxy/envoy/blob/c61838567f214812b991f0c76db935a54300d94a/test/extensions/http/header_validators/envoy_default/http2_header_validator_test.cc#L441 and https://github.com/envoyproxy/envoy/blob/c61838567f214812b991f0c76db935a54300d94a/test/extensions/http/header_validators/envoy_default/http2_header_validator_test.cc#L729 look the same. So I removed the 1st test case.

Winbobob avatar Aug 19 '24 18:08 Winbobob

Hi @yanavlasov, wonder any chance to merge this pr?

Winbobob avatar Aug 23 '24 01:08 Winbobob

Kindly reminder, please check it again, thanks cc @yanavlasov

Winbobob avatar Aug 29 '24 19:08 Winbobob

bump @yanavlasov

phlax avatar Sep 03 '24 16:09 phlax

Sorry for the delay. Had to deal with internal production issues.

yanavlasov avatar Sep 05 '24 23:09 yanavlasov