-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Adding a test of TCP with TLS termination (test-only change) #1183
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e338835
Working TCP+TLS tests!
alyssawilk f6d2173
All your pointers are belong to GFE
alyssawilk 7cf2e95
Removing more pointers
alyssawilk e568657
const + comments
alyssawilk d568bbc
Making stats more thread safe
alyssawilk 3016ddb
Merge branch 'refs/heads/master' into tcp-tests
alyssawilk 69e5e89
alphabetic order
alyssawilk fb3792a
reviewer-prompted cleanups
alyssawilk 29069e4
Merge branch 'refs/heads/master' into tcp-tests
alyssawilk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| { | ||
| "listeners": [ | ||
| { | ||
| "address": "tcp://{{ ip_loopback_address }}:0", | ||
| "filters": [ | ||
| { "type": "read", "name": | ||
| "tcp_proxy", | ||
| "config": { | ||
| "stat_prefix": "test_tcp", | ||
| "route_config": { | ||
| "routes": [ | ||
| { | ||
| "cluster": "cluster_1" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "address": "tcp://{{ ip_loopback_address }}:0", | ||
| "ssl_context": { | ||
| "ca_cert_file": "{{ test_rundir }}/test/config/integration/certs/cacert.pem", | ||
| "cert_chain_file": "{{ test_rundir }}/test/config/integration/certs/servercert.pem", | ||
| "private_key_file": "{{ test_rundir }}/test/config/integration/certs/serverkey.pem", | ||
| "alpn_protocols": "h2,http/1.1", | ||
| "alt_alpn_protocols": "http/1.1" | ||
| }, | ||
| "filters": [ | ||
| { "type": "read", "name": "tcp_proxy", | ||
| "config": { | ||
| "stat_prefix": "test_tcp_sans_tls", | ||
| "route_config": { | ||
| "routes": [ | ||
| { | ||
| "cluster": "cluster_1" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| }, | ||
| { "type": "read", "name": "client_ssl_auth", | ||
| "config": { | ||
| "auth_api_cluster": "ssl_auth", | ||
| "stat_prefix": "ssl_stats", | ||
| "refresh_delay_ms": 600000, | ||
| "ip_white_list": [ "127.0.0.1/32", "::1/64"] | ||
| } | ||
| } | ||
| ] | ||
| }], | ||
| "admin": { "access_log_path": "/dev/null", "address": "tcp://{{ ip_loopback_address }}:0" }, | ||
| "statsd_udp_ip_address": "{{ ip_loopback_address }}:8125", | ||
|
|
||
| "cluster_manager": { | ||
| "clusters": [ | ||
| { | ||
| "name": "cluster_1", | ||
| "connect_timeout_ms": 5000, | ||
| "type": "static", | ||
| "lb_type": "round_robin", | ||
| "hosts": [{"url": "tcp://{{ ip_loopback_address }}:{{ upstream_0 }}"}] | ||
| }, | ||
| { | ||
| "name": "ssl_auth", | ||
| "connect_timeout_ms": 5000, | ||
| "type": "strict_dns", | ||
| "lb_type": "round_robin", | ||
| "dns_lookup_family": "{{ dns_lookup_family }}", | ||
| "hosts": [{"url": "tcp://localhost:{{ upstream_1 }}"}] | ||
| }] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,50 @@ class TestComponentFactory : public ComponentFactory { | |
|
|
||
| namespace Stats { | ||
|
|
||
| /** | ||
| * This is a wrapper for Scopes for the TestIsolatedStoreImpl to ensure new scopes do | ||
| * not interact with the store without grabbing the lock from TestIsolatedStoreImpl. | ||
| */ | ||
| class TestScopeWrapper : public Scope { | ||
| public: | ||
| TestScopeWrapper(std::mutex& lock, ScopePtr wrapped_scope) | ||
| : lock_(lock), wrapped_scope_(std::move(wrapped_scope)) {} | ||
|
|
||
| virtual ~TestScopeWrapper() { | ||
| std::unique_lock<std::mutex> lock(lock_); | ||
| wrapped_scope_.reset(); | ||
| } | ||
|
|
||
| virtual void deliverHistogramToSinks(const std::string& name, uint64_t value) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these should all be |
||
| std::unique_lock<std::mutex> lock(lock_); | ||
| wrapped_scope_->deliverHistogramToSinks(name, value); | ||
| } | ||
|
|
||
| virtual void deliverTimingToSinks(const std::string& name, std::chrono::milliseconds ms) { | ||
| std::unique_lock<std::mutex> lock(lock_); | ||
| wrapped_scope_->deliverTimingToSinks(name, ms); | ||
| } | ||
|
|
||
| virtual Counter& counter(const std::string& name) { | ||
| std::unique_lock<std::mutex> lock(lock_); | ||
| return wrapped_scope_->counter(name); | ||
| } | ||
|
|
||
| virtual Gauge& gauge(const std::string& name) { | ||
| std::unique_lock<std::mutex> lock(lock_); | ||
| return wrapped_scope_->gauge(name); | ||
| } | ||
|
|
||
| virtual Timer& timer(const std::string& name) { | ||
| std::unique_lock<std::mutex> lock(lock_); | ||
| return wrapped_scope_->timer(name); | ||
| } | ||
|
|
||
| private: | ||
| std::mutex& lock_; | ||
| ScopePtr wrapped_scope_; | ||
| }; | ||
|
|
||
| /** | ||
| * This is a variant of the isolated store that has locking across all operations so that it can | ||
| * be used during the integration tests. | ||
|
|
@@ -111,7 +155,8 @@ class TestIsolatedStoreImpl : public StoreRoot { | |
| } | ||
| ScopePtr createScope(const std::string& name) override { | ||
| std::unique_lock<std::mutex> lock(lock_); | ||
| return store_.createScope(name); | ||
| ScopePtr tmp = store_.createScope(name); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Is the intermediate here needed? |
||
| return ScopePtr{new TestScopeWrapper(lock_, std::move(tmp))}; | ||
| } | ||
|
|
||
| // Stats::StoreRoot | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this needed? Won't this self-destruct?