Skip to content

[test] split out mocks#5278

Merged
zuercher merged 4 commits intoenvoyproxy:masterfrom
klarose:split_out_mocks
Dec 13, 2018
Merged

[test] split out mocks#5278
zuercher merged 4 commits intoenvoyproxy:masterfrom
klarose:split_out_mocks

Conversation

@klarose
Copy link
Copy Markdown
Contributor

@klarose klarose commented Dec 12, 2018

Description: While developing the source transparency feature, I became frustrated with both the compile time of some of the tests, and the fact that changes in seemingly unrelated headers caused many tests to recompile. Much of this was caused by the monolithic mocks headers we use. Since they include everything for a high level component, any header depended upon by that component, which is likely many, being changed can cause a recompilation. Further, simply including that much slows down compilation.

As an example, I found that splitting out the connection pool mocks decreased my unit test compile time from 13 seconds to 8 seconds. While not a drastic speedup, 5 seconds per compile is still quite a bit if you're doing TDD. You want feedback as quickly as possible!

This PR was split out of #5255 with some minor changes to remove code that only applied in that PR.

Risk Level: Low. This is just testing headers.

Testing: Ran the tests multiple times.

Docs Changes: N/A
Release Notes: N/A

This should speed up compilation for tests that use only these mocks.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
More work to minimize the size of headers in UTs to hopefully speed them
up.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
The network mocks header is quite large. I only need access to the
connection mocks for my UT. So, split out the network mocks into their
own header to decrease test compile times.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
@klarose
Copy link
Copy Markdown
Contributor Author

klarose commented Dec 12, 2018

@lizan I have split out the mocks from #5255 here as requested.

@lizan lizan self-assigned this Dec 12, 2018
Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! LGTM modulo small nits.

- Don't forward declare unless necessary
- Use make_shared when allocated directly into a shared_ptr.

Signed-off-by: Kyle Larose <kyle@agilicus.com>
@zuercher zuercher merged commit fcbaa43 into envoyproxy:master Dec 13, 2018
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
While developing the source transparency feature, I became frustrated with both the compile time of some of the tests, and the fact that changes in seemingly unrelated headers caused many tests to recompile. Much of this was caused by the monolithic mocks headers we use. Since they include everything for a high level component, any header depended upon by that component, which is likely many, being changed can cause a recompilation. Further, simply including that much slows down compilation.

As an example, I found that splitting out the connection pool mocks decreased my unit test compile time from 13 seconds to 8 seconds. While not a drastic speedup, 5 seconds per compile is still quite a bit if you're doing TDD. You want feedback as quickly as possible!

This PR was split out of envoyproxy#5255 with some minor changes to remove code that only applied in that PR.

Risk Level: Low. This is just testing headers.
Testing: Ran the tests multiple times.
Docs Changes: N/A
Release Notes: N/A

Signed-off-by: Kyle Larose <kyle@agilicus.com>
Signed-off-by: Fred Douglas <fredlas@google.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.

3 participants