Skip to content
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

test: Split huge monolith mock header to speed up test compilation #11649

Merged
merged 10 commits into from
Jun 25, 2020

Conversation

foreseeable
Copy link
Contributor

@foreseeable foreseeable commented Jun 19, 2020

Commit Message: Split huge monolith mock header to speed up test compilation
Additional Description: cluster_manager_test only used a simple mock class MockAdmin from test/mocks/server/mocks.h, which is a huge mock library. After splitting, the overall build time for cluster_manager_test reduced from 143.481s to 82.443s in my build cluster.

Risk Level: low
Testing: existing tests
Docs Changes: N/A
Release Notes: no
Related Issues: #10917

Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
@htuch htuch requested a review from lizan June 19, 2020 12:09
@ahedberg
Copy link
Contributor

@asraa FYI

Copy link
Contributor

@ahedberg ahedberg left a comment

Choose a reason for hiding this comment

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

Congrats on getting your first PR out for review!

test/mocks/server/admin.cc Outdated Show resolved Hide resolved
test/mocks/server/config_tracker.cc Outdated Show resolved Hide resolved
test/mocks/server/config_tracker.h Outdated Show resolved Hide resolved
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
@foreseeable
Copy link
Contributor Author

The overall build time for cluster_manager_test has been further improved to 68.689s in my build cluster by removing superfluous includes in divided headers.


#include "absl/strings/string_view.h"
#include "config_tracker.h"
#include "gmock/gmock.h"
#include "spdlog/spdlog.h"

using testing::NiceMock;
Copy link
Contributor

Choose a reason for hiding this comment

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

Using-declarations should only be used in .cc files. See https://google.github.io/styleguide/cppguide.html#Namespaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

#include "gmock/gmock.h"
#include "gtest/gtest.h"

using testing::_;
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be moved to inside the innermost namespace, and they should be fully-qualified. See https://abseil.io/tips/119

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: Muge Chen <mugechen@google.com>
@sunjayBhatia
Copy link
Member

Just a nit on the PR description, the comment Partly Fixes #10917 will close the original issue (if you hover over Fixes), I would guess there is additional work to be done for that issue, should we adjust that part of the PR description?

@foreseeable
Copy link
Contributor Author

@sunjayBhatia Thanks for your advice. Now the PR description has been adjusted to "Related Issues"

Copy link
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!

@lizan lizan merged commit 6a6c079 into envoyproxy:master Jun 25, 2020
@foreseeable foreseeable deleted the split_mock_server branch June 25, 2020 04:01
chaoqin-li1123 pushed a commit to chaoqin-li1123/envoy that referenced this pull request Jun 25, 2020
…nvoyproxy#11649)

Commit Message: Split huge monolith mock header to speed up test compilation
Additional Description: `cluster_manager_test` only used a simple mock class `MockAdmin` from `test/mocks/server/mocks.h`, which is a huge mock library. After splitting, the overall build time for `cluster_manager_test` reduced from 143.481s to 82.443s in my build cluster.

Risk Level: low
Testing: existing tests
Docs Changes: N/A
Release Notes: no
Related Issues: envoyproxy#10917

Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: chaoqinli <chaoqinli@google.com>
songhu pushed a commit to songhu/envoy that referenced this pull request Jun 25, 2020
…nvoyproxy#11649)

Commit Message: Split huge monolith mock header to speed up test compilation
Additional Description: `cluster_manager_test` only used a simple mock class `MockAdmin` from `test/mocks/server/mocks.h`, which is a huge mock library. After splitting, the overall build time for `cluster_manager_test` reduced from 143.481s to 82.443s in my build cluster.

Risk Level: low
Testing: existing tests
Docs Changes: N/A
Release Notes: no
Related Issues: envoyproxy#10917 

Signed-off-by: Muge Chen <mugechen@google.com>
yashwant121 pushed a commit to yashwant121/envoy that referenced this pull request Jul 24, 2020
…nvoyproxy#11649)

Commit Message: Split huge monolith mock header to speed up test compilation
Additional Description: `cluster_manager_test` only used a simple mock class `MockAdmin` from `test/mocks/server/mocks.h`, which is a huge mock library. After splitting, the overall build time for `cluster_manager_test` reduced from 143.481s to 82.443s in my build cluster.

Risk Level: low
Testing: existing tests
Docs Changes: N/A
Release Notes: no
Related Issues: envoyproxy#10917 

Signed-off-by: Muge Chen <mugechen@google.com>
Signed-off-by: yashwant121 <yadavyashwant36@gmail.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.

4 participants