-
Notifications
You must be signed in to change notification settings - Fork 686
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
[v2.4] Add more tests for TCPMappings #4493
Conversation
These two bumps are required for pytest to work with Python 3.10. This doesn't matter for builds, or for in CI, but this does matter for developers whose system Python is up-to-date. Since Emissary 1.14 is in maintenance mode, I did the smallest upgrades possible to get things working. For typed-ast, that means including python/typed_ast#158, which was first included in 1.4.3. For pytest, that means 6.2.5, since that's when the changelog mentions "Python 3.10 is now supported." https://docs.pytest.org/en/stable/changelog.html#pytest-6-2-5-2021-08-29 Signed-off-by: Luke Shumaker <[email protected]>
Signed-off-by: Luke Shumaker <[email protected]> (cherry picked from commit fc40a4d)
Signed-off-by: Luke Shumaker <[email protected]> (cherry picked from commit 03be3e9)
Signed-off-by: Luke Shumaker <[email protected]> (cherry picked from commit e3af51a) This cherry pick is needed because several of the certs are now expired; I don't care about the SAN, I care about the timestamps. I also had to touch up t_tls.py, since it's checking for some details of the certs, and those details changed. I didn't have to do that in the original commit because I guess those tests had been marked as xfail. Yikes! Signed-off-by: Luke Shumaker <[email protected]>
Signed-off-by: Luke Shumaker <[email protected]>
… [ci-skip] Signed-off-by: Luke Shumaker <[email protected]>
863bc86
to
ad1e2f2
Compare
c250272
to
f3d5237
Compare
Signed-off-by: Luke Shumaker <[email protected]>
When splitting KAT tests among multiple jobs, we need a listing of all of the KAT tests; we'll assign each entry in this list to a different job. The problem with that right now is that the expressions in that listing are sometimes ambiguous. For example, "AuthenticationTest" shows up as `kat[AuthenticationTest`. Notice that it doesn't include a trailing `]`; this causes it to also match the "AuthenticationTestV1". If both of those tests were going to be scheduled on the same job, that's fine; but if they were going to be scheduled on different jobs, then that "AuthenticationTestV1" test will run in *both* jobs, potentially overloading the one where it wasn't supposed to run. This is probably less of a problem for that one test, and a bigger problem for common prefixes like "TLS". Here is a listing of all such ambiguities: $ grep -f <(<build-aux/pytest-kat.txt sed -e 's/\[/\\[/g' -e 's/$/./') build-aux/pytest-kat.txt kat[AuthenticationTestV1 kat[ClientCertificateAuthenticationContext kat[ClientCertificateAuthenticationContextCRL kat[DnsTtlDnsType kat[DnsTtlEndpoint kat[ErrorResponseMappingBypassAlternate kat[ErrorResponseOnStatusCodeMappingCRD kat[HostCRDDoubleCrossNamespace kat[HostCRDManualContextCRL kat[LogicalDnsTypeEndpoint kat[RedirectTestsInvalidSecret kat[RedirectTestsWithProxyProto kat[TLSCoalescing kat[TLSContextCipherSuites kat[TLSContextIstioSecretTest kat[TLSContextProtocolMaxVersion kat[TLSContextProtocolMinVersion kat[TLSContextTest kat[TLSContextsTest kat[TLSIngressTest kat[TLSInheritFromModule kat[TLSInvalidSecret kat[TLSOriginationSecret kat[TracingTestLongClusterName kat[TracingTestSampling kat[TracingTestShortTraceId kat[TracingTestZipkinV1 kat[TracingTestZipkinV2 Signed-off-by: Luke Shumaker <[email protected]> (cherry picked from commit 67279ec)
Yep, because of the horror that is self.skip_node! Eradicating skip_node seems like a bigger task, so just accept the horror as is. Signed-off-by: Luke Shumaker <[email protected]>
f3d5237
to
edc01e7
Compare
def manifests(self) -> str: | ||
return format(''' | ||
--- | ||
apiVersion: getambassador.io/v3alpha1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also be testing with https
and port 80 to ensure that v3alpha1 honors the scheme similar to TCPMappingTLSOriginationV2SchemeTest
? Seems like that's the intention as extra_ports
has two elements but only one is used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, it was a mistake that I left 6790
in extra_ports
.
The difference is that in v2 it didn't support saying "originate TLS by adding https://
to the service
; but in v3alpha1 this is the primary way of originating TLS without a client cert (since v3alpha1 doesn't support tls: true
, which is how you did that in v2.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a commit removing 6790
from extra_ports
.
ambassador_id: [ {self.ambassador_id} ] | ||
port: 6789 | ||
service: {self.target.path.fqdn}:443 | ||
tls: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly just curious what tls==true means since I thought you were supposed to supply a TLSContext to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tls: true
was how you said "originate TLS without a client cert (and with the default settings)" in v2; in v3alpha1 you do this by adding https://
to the service
(since allowing tls
to be either a bool or a string is a violation of Kubernetes structural typing, which is something that v3alpha1 was going for).
ambassador_id: [ {self.ambassador_id} ] | ||
port: 6789 | ||
service: {self.target.path.fqdn}:443 | ||
tls: {self.name.k8s}-tlsclient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you have two TLSContexts with the same name but in different namespaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The answer is poorly defined, and I hate it, but it's OK that it's poorly defined since it's always been poorly defined.
Good question though.
I'd accidentally included an extra `extra_port` in one of the tests because I'd copied it from a different test. Thanks to @haq204 for pointing out this mistake. Signed-off-by: Luke Shumaker <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks fine overall
Description
This PR adds a bunch of tests for TCPMappings, many of them marked
xfail
. Even so, it isn't quite as complete as I would like it to be; see the "TODO" comments at the bottom oft_tcpmapping.py
.This builds on the tests that are verified to work with 1.14 from #4477.
Cherry-picks some reliability improvements from #4308
Related Issues
Testing
That's all this is.
Checklist
I made sure to update
CHANGELOG.md
. - no applicable changesRemember, the CHANGELOG needs to mention:
This is unlikely to impact how Ambassador performs at scale. - not a runtime change
Remember, things that might have an impact at scale include:
My change is adequately tested. - that's all this is
Remember when considering testing:
I updated
DEVELOPING.md
with any any special dev tricks I had to use to work on this code efficiently. - no tricksThe changes in this PR have been reviewed for security concerns and adherence to security best practices.