Skip to content

tls: plumb time source to context manager#4810

Merged
htuch merged 6 commits intoenvoyproxy:masterfrom
ramaraochavali:fix/tls_timesource
Oct 23, 2018
Merged

tls: plumb time source to context manager#4810
htuch merged 6 commits intoenvoyproxy:masterfrom
ramaraochavali:fix/tls_timesource

Conversation

@ramaraochavali
Copy link
Copy Markdown
Contributor

@ramaraochavali ramaraochavali commented Oct 22, 2018

Description: Plumbs time source to context manager as discussed in #4701. This is to allow control time on Utility::getDaysUntilExpiration method.
Risk Level: Low
Testing: Existing automated tests
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Rama <rama.rao@salesforce.com>
@ramaraochavali
Copy link
Copy Markdown
Contributor Author

@lizan can you PTAL?

Copy link
Copy Markdown
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good apart from nits

Comment thread test/common/ssl/utility_test.cc Outdated
TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem"));
EXPECT_LE(0, Utility::getDaysUntilExpiration(cert.get()));
Event::SimulatedTimeSystem time_source;
time_source.setSystemTime(std::chrono::system_clock::from_time_t(1540080000));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment where that constant comes from and/or declare it as a const.

Comment thread test/common/ssl/context_impl_test.cc Outdated
ClientContextConfigImpl cfg(tls_context, factory_context_);
Runtime::MockLoader runtime;
ContextManagerImpl manager(runtime);
Event::SimulatedTimeSystem time_system;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest putting this as a test class member var.

@dnoe dnoe assigned lizan and htuch Oct 22, 2018
@htuch
Copy link
Copy Markdown
Member

htuch commented Oct 23, 2018

@ramaraochavali can you update the description to explain that it's ultimately Utility::getDaysUntilExpiration we want to control the time on? Thanks.

Signed-off-by: Rama <rama.rao@salesforce.com>
Signed-off-by: Rama <rama.rao@salesforce.com>
Signed-off-by: Rama <rama.rao@salesforce.com>
Signed-off-by: Rama <rama.rao@salesforce.com>
@ramaraochavali
Copy link
Copy Markdown
Contributor Author

@jmarantz addressed the comments. PTAL.

jmarantz
jmarantz previously approved these changes Oct 23, 2018
Comment thread test/common/ssl/context_impl_test.cc Outdated

class SslContextImplTest : public SslCertsTest {};
class SslContextImplTest : public SslCertsTest {
public:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw usually 'protected:' is used here as all the test methods are effectively subclasses. Just a suggestion.

Runtime::MockLoader runtime;
Event::SimulatedTimeSystem time_system;
ContextManagerImpl manager(runtime, time_system);
ContextManagerImpl manager(runtime, time_system_);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess while in here I would also put runtime and manager in the class to factor out these common initializations but this is pre-existing, so I will leave it up to you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do a follow-up PR with this

Signed-off-by: Rama <rama.rao@salesforce.com>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ramaraochavali!

@htuch htuch merged commit 83188c7 into envoyproxy:master Oct 23, 2018
@ramaraochavali ramaraochavali deleted the fix/tls_timesource branch October 24, 2018 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants