Skip to content

ssl: temporariliy fix utility test#4701

Merged
alyssawilk merged 2 commits intoenvoyproxy:masterfrom
lizan:ssl_utility_test_fix
Oct 12, 2018
Merged

ssl: temporariliy fix utility test#4701
alyssawilk merged 2 commits intoenvoyproxy:masterfrom
lizan:ssl_utility_test_fix

Conversation

@lizan
Copy link
Copy Markdown
Member

@lizan lizan commented Oct 12, 2018

Signed-off-by: Lizan Zhou lizan@tetrate.io

Description:
Quick fix of time dependent SSL utility test introduced in #4686.

Risk Level: Low
Testing: CI
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Comment thread test/common/ssl/utility_test.cc Outdated
TEST(UtilityTest, TestDaysUntilExpiration) {
bssl::UniquePtr<X509> cert = readCertFromFile("test/common/ssl/test_data/san_dns_cert.pem");
EXPECT_EQ(270, Utility::getDaysUntilExpiration(cert.get()));
EXPECT_GE(0, Utility::getDaysUntilExpiration(cert.get()));
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 think it should be reverse?

Copy link
Copy Markdown
Contributor

@ramaraochavali ramaraochavali left a comment

Choose a reason for hiding this comment

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

should be reversed? Sorry. I missed this point. Thanks for fixing it.

Signed-off-by: Lizan Zhou <lizan@tetrate.io>
TEST(UtilityTest, TestDaysUntilExpiration) {
bssl::UniquePtr<X509> cert = readCertFromFile("test/common/ssl/test_data/san_dns_cert.pem");
EXPECT_EQ(270, Utility::getDaysUntilExpiration(cert.get()));
EXPECT_LE(0, Utility::getDaysUntilExpiration(cert.get()));
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.

Can we inject TimeSource into getDaysUntilExpiration?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, +1, if we can do this quickly and unblock CI, this is the right thing to do. If we need something to just unblock CI, lets do the current PR with the TODO.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes I left it as a TODO, didn't want to introduce more to unblock CI quickly.

@jmarantz
Copy link
Copy Markdown
Contributor

If you submit this as the hack you have, we'll be good to go till next summer. In that case you should probably hijack #4703 to indicate it's still broken and time needs to be injected.

If you get time injected properly then #4703 can be closed when this is merged.

Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Synced with htuch offline - I'm just going to go ahead and merge this to unbreak CI.
We can do the long term fix later.

@alyssawilk alyssawilk merged commit 4337516 into envoyproxy:master Oct 12, 2018
@alyssawilk
Copy link
Copy Markdown
Contributor

Also thank you for the quick fix, @lizan!!

htuch pushed a commit that referenced this pull request Oct 23, 2018
 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>
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.

5 participants