Add option to serve TLS in testutils.NewServerChannel#882
Add option to serve TLS in testutils.NewServerChannel#882DheerendraRathor merged 1 commit intodevfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #882 +/- ##
==========================================
+ Coverage 88.93% 89.50% +0.56%
==========================================
Files 43 43
Lines 4439 4439
==========================================
+ Hits 3948 3973 +25
+ Misses 370 349 -21
+ Partials 121 117 -4
Continue to review full report at Codecov.
|
a8f3d49 to
66c898d
Compare
| func getTLSListener() (net.Listener, error) { | ||
| cert, err := tls.X509KeyPair(testcert.TestCert, testcert.TestKey) | ||
| if err != nil { | ||
| panic(fmt.Sprintf("testutils: getTLSListener: %v", err)) |
There was a problem hiding this comment.
somewhat bummed we need to panic here, but I guess it's too late to pass in *testing.T now.
There was a problem hiding this comment.
I feel that panic is good here since we never expect this to fail.
Go uses same for httptest https://github.com/golang/go/blob/master/src/net/http/httptest/server.go#L151
| }) | ||
| } | ||
|
|
||
| func TestWithTLSNoRelay(t *testing.T) { |
There was a problem hiding this comment.
wondering out loud - how can we limit the use of TLS to only muttley? I don't think we want to end up supporting peer-to-peer TLS. but maybe it's not something we can do easily...
There was a problem hiding this comment.
tchannel can support mTLS for non-relay use cases. In fact, we're also going to use that in p2p routing outside muttley.
With relay, tchannel can't support mTLS, but TLS use case is still there.
Added `ServeTLS` in `testutils.ChannelOpts` to create a test server with TLS listener listening on port 0. TLS listener uses a static cert/key pair present in `internal/testcert` package to prevent accidental use of the cert in production.
66c898d to
5cc4eaa
Compare
Added `ServeTLS` in `testutils.ChannelOpts` to create a test server with TLS listener listening on port 0. TLS listener uses a static cert/key pair present in `internal/testcert` package to prevent accidental use of the cert in production.
Added `ServeTLS` in `testutils.ChannelOpts` to create a test server with TLS listener listening on port 0. TLS listener uses a static cert/key pair present in `internal/testcert` package to prevent accidental use of the cert in production.
Added `ServeTLS` in `testutils.ChannelOpts` to create a test server with TLS listener listening on port 0. TLS listener uses a static cert/key pair present in `internal/testcert` package to prevent accidental use of the cert in production.
Added
ServeTLSintestutils.ChannelOptsto create a test server with TLS listener listening on port 0.TLS listener uses a static cert/key pair present in
internal/testcertpackage to prevent accidental use of the cert in production.