Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tap: return an error when a
PortRange
's min > max
The quickcheck tests for tap that were re-enabled in PR #1042 have caught a bug: when a `PortMatch` message has a `min` value that's greater than its `max` value, the tests expect that `TcpMatch::try_from` should return an error (since the range is obviously invalid). However, we don't currently do that. This is causing CI to break on an unrelated change: https://github.com/linkerd/linkerd2-proxy/runs/2797285941#step:3:907 This PR adds a new test reproducing the failing quickcheck inputs, and fixes the bug (by making `TcpMatch::try_from` return an error in that case). Since quickcheck inputs are randomly generated and are not deterministic, I thought it was probably a good idea to have a hard-coded test to reproduce this case, just in case there are future regressions. As a side note, we may want to consider switching from the `quickcheck` crate to the [`proptest` crate] --- one nice feature of `proptest` is that it automatically records failing inputs, which can be checked in to git, and future test runs will try all the failing inputs as well as randomly generating new ones. [`proptest` crate]: https://github.com/AltSysrq/proptest
- Loading branch information