Skip to content

Commit

Permalink
test: refactor header inclusion to speed up building (for test/server…
Browse files Browse the repository at this point in the history
…/...) (envoyproxy#12045)

Commit Message: refactor header inclusion to speed up building (for test/server/...)
Additional Description:
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: scheler <santosh.cheler@appdynamics.com>
  • Loading branch information
foreseeable authored and scheler committed Aug 4, 2020
1 parent 18a065d commit e5d3f72
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 37 deletions.
41 changes: 30 additions & 11 deletions test/server/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ envoy_cc_test(
":utility_lib",
"//source/server:listener_manager_lib",
"//test/mocks/network:network_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:instance_mocks",
"//test/mocks/server:listener_component_factory_mocks",
"//test/mocks/server:worker_factory_mocks",
"//test/mocks/server:worker_mocks",
"//test/test_common:utility_lib",
"@envoy_api//envoy/config/listener/v3:pkg_cc_proto",
],
Expand Down Expand Up @@ -55,7 +58,7 @@ envoy_cc_test(
"//test/common/upstream:utility_lib",
"//test/mocks:common_lib",
"//test/mocks/network:network_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:instance_mocks",
"//test/test_common:environment_lib",
"//test/test_common:utility_lib",
"@envoy_api//envoy/config/bootstrap/v3:pkg_cc_proto",
Expand Down Expand Up @@ -89,7 +92,7 @@ envoy_cc_test(
srcs = ["drain_manager_impl_test.cc"],
deps = [
"//source/server:drain_manager_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/server:instance_mocks",
"@envoy_api//envoy/config/listener/v3:pkg_cc_proto",
],
)
Expand Down Expand Up @@ -130,7 +133,7 @@ envoy_cc_test(
"//source/common/stats:stats_lib",
"//source/server:guarddog_lib",
"//test/mocks:common_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/server:main_mocks",
"//test/mocks/stats:stats_mocks",
"//test/test_common:simulated_time_system_lib",
"//test/test_common:utility_lib",
Expand Down Expand Up @@ -188,8 +191,10 @@ envoy_cc_test(
"//source/common/protobuf:utility_lib",
"//source/server:lds_api_lib",
"//test/mocks/config:config_mocks",
"//test/mocks/init:init_mocks",
"//test/mocks/protobuf:protobuf_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:listener_manager_mocks",
"//test/mocks/upstream:upstream_mocks",
"//test/test_common:environment_lib",
"//test/test_common:utility_lib",
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
Expand All @@ -207,7 +212,12 @@ envoy_cc_test_library(
"//source/server:listener_manager_lib",
"//test/mocks/init:init_mocks",
"//test/mocks/network:network_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:drain_manager_mocks",
"//test/mocks/server:guard_dog_mocks",
"//test/mocks/server:instance_mocks",
"//test/mocks/server:listener_component_factory_mocks",
"//test/mocks/server:worker_factory_mocks",
"//test/mocks/server:worker_mocks",
"//test/test_common:environment_lib",
"//test/test_common:simulated_time_system_lib",
"//test/test_common:test_runtime_lib",
Expand Down Expand Up @@ -291,7 +301,8 @@ envoy_cc_test(
"//source/server:filter_chain_manager_lib",
"//source/server:listener_manager_lib",
"//test/mocks/network:network_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:drain_manager_mocks",
"//test/mocks/server:factory_context_mocks",
"//test/test_common:environment_lib",
"//test/test_common:registry_lib",
"//test/test_common:simulated_time_system_lib",
Expand All @@ -309,7 +320,9 @@ envoy_cc_fuzz_test(
"//source/common/thread_local:thread_local_lib",
"//source/server:server_lib",
"//test/integration:integration_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/server:options_mocks",
"//test/mocks/server:hot_restart_mocks",
"//test/mocks/stats:stats_mocks",
"//test/test_common:environment_lib",
] + select({
"//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS),
Expand Down Expand Up @@ -358,7 +371,11 @@ envoy_cc_test(
"//test/common/config:dummy_config_proto_cc_proto",
"//test/common/stats:stat_test_utility_lib",
"//test/integration:integration_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/server:bootstrap_extension_factory_mocks",
"//test/mocks/server:hot_restart_mocks",
"//test/mocks/server:instance_mocks",
"//test/mocks/server:options_mocks",
"//test/mocks/server:overload_manager_mocks",
"//test/mocks/stats:stats_mocks",
"//test/test_common:registry_lib",
"//test/test_common:simulated_time_system_lib",
Expand Down Expand Up @@ -398,7 +415,9 @@ envoy_cc_test(
"//source/common/event:dispatcher_lib",
"//source/server:worker_lib",
"//test/mocks/network:network_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:guard_dog_mocks",
"//test/mocks/server:instance_mocks",
"//test/mocks/server:overload_manager_mocks",
"//test/mocks/thread_local:thread_local_mocks",
"//test/test_common:utility_lib",
],
Expand All @@ -416,7 +435,7 @@ envoy_cc_benchmark_binary(
"//source/server:filter_chain_manager_lib",
"//test/test_common:environment_lib",
"//test/mocks/network:network_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:factory_context_mocks",
# tranport socket config registration
"//source/extensions/transport_sockets/tls:config",
],
Expand Down
4 changes: 2 additions & 2 deletions test/server/admin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ envoy_cc_test_library(
deps = [
"//source/server/admin:admin_lib",
"//test/mocks/runtime:runtime_mocks",
"//test/mocks/server:server_mocks",
"//test/mocks/server:instance_mocks",
"//test/test_common:environment_lib",
"//test/test_common:network_utility_lib",
],
Expand Down Expand Up @@ -54,7 +54,7 @@ envoy_cc_test(
srcs = ["admin_filter_test.cc"],
deps = [
"//source/server/admin:admin_filter_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/server:instance_mocks",
"//test/test_common:environment_lib",
],
)
Expand Down
2 changes: 1 addition & 1 deletion test/server/admin/admin_filter_test.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "server/admin/admin_filter.h"

#include "test/mocks/server/mocks.h"
#include "test/mocks/server/instance.h"
#include "test/test_common/environment.h"

#include "gmock/gmock.h"
Expand Down
2 changes: 1 addition & 1 deletion test/server/admin/admin_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "test/mocks/http/mocks.h"
#include "test/mocks/runtime/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/instance.h"
#include "test/test_common/environment.h"
#include "test/test_common/network_utility.h"

Expand Down
5 changes: 4 additions & 1 deletion test/server/api_listener_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
#include "server/listener_manager_impl.h"

#include "test/mocks/network/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/instance.h"
#include "test/mocks/server/listener_component_factory.h"
#include "test/mocks/server/worker.h"
#include "test/mocks/server/worker_factory.h"
#include "test/server/utility.h"
#include "test/test_common/utility.h"

Expand Down
5 changes: 3 additions & 2 deletions test/server/config_validation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ envoy_cc_test(
"//source/extensions/transport_sockets/tls:config",
"//source/server/config_validation:server_lib",
"//test/integration:integration_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/server:options_mocks",
"//test/mocks/stats:stats_mocks",
"//test/test_common:environment_lib",
"//test/test_common:registry_lib",
Expand Down Expand Up @@ -98,7 +98,8 @@ envoy_cc_fuzz_test(
"//source/common/common:thread_lib",
"//source/server/config_validation:server_lib",
"//test/integration:integration_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/server:options_mocks",
"//test/test_common:environment_lib",
] + select({
"//bazel:windows_x86_64": envoy_all_extensions(WINDOWS_SKIP_TARGETS),
"//bazel:linux_ppc": envoy_all_extensions(PPC_SKIP_TARGETS),
Expand Down
3 changes: 2 additions & 1 deletion test/server/config_validation/config_fuzz_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

#include "test/fuzz/fuzz_runner.h"
#include "test/integration/server.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/options.h"
#include "test/test_common/environment.h"

namespace Envoy {
namespace Server {
Expand Down
3 changes: 2 additions & 1 deletion test/server/config_validation/server_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#include "server/config_validation/server.h"

#include "test/integration/server.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/options.h"
#include "test/mocks/stats/mocks.h"
#include "test/test_common/environment.h"
#include "test/test_common/registry.h"
#include "test/test_common/test_time.h"

namespace Envoy {
namespace Server {
Expand Down
2 changes: 1 addition & 1 deletion test/server/configuration_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "test/common/upstream/utility.h"
#include "test/mocks/common.h"
#include "test/mocks/network/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/instance.h"
#include "test/test_common/environment.h"
#include "test/test_common/utility.h"

Expand Down
2 changes: 1 addition & 1 deletion test/server/drain_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "server/drain_manager_impl.h"

#include "test/mocks/server/mocks.h"
#include "test/mocks/server/instance.h"

#include "gmock/gmock.h"
#include "gtest/gtest.h"
Expand Down
2 changes: 1 addition & 1 deletion test/server/filter_chain_benchmark_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "extensions/transport_sockets/well_known_names.h"

#include "test/mocks/network/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/factory_context.h"
#include "test/test_common/environment.h"
#include "test/test_common/utility.h"

Expand Down
3 changes: 2 additions & 1 deletion test/server/filter_chain_manager_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#include "extensions/transport_sockets/tls/ssl_socket.h"

#include "test/mocks/network/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/drain_manager.h"
#include "test/mocks/server/factory_context.h"
#include "test/server/utility.h"
#include "test/test_common/environment.h"
#include "test/test_common/registry.h"
Expand Down
2 changes: 1 addition & 1 deletion test/server/guarddog_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "server/guarddog_impl.h"

#include "test/mocks/common.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/main.h"
#include "test/mocks/stats/mocks.h"
#include "test/test_common/simulated_time_system.h"
#include "test/test_common/test_time.h"
Expand Down
2 changes: 1 addition & 1 deletion test/server/hot_restart_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "test/mocks/api/hot_restart.h"
#include "test/mocks/api/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/hot_restart.h"
#include "test/test_common/logging.h"
#include "test/test_common/threadsafe_singleton_injector.h"

Expand Down
3 changes: 2 additions & 1 deletion test/server/hot_restarting_parent_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include "server/hot_restarting_parent.h"

#include "test/mocks/network/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/instance.h"
#include "test/mocks/server/listener_manager.h"

#include "gtest/gtest.h"

Expand Down
15 changes: 9 additions & 6 deletions test/server/lds_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@
#include "server/lds_api.h"

#include "test/mocks/config/mocks.h"
#include "test/mocks/init/mocks.h"
#include "test/mocks/protobuf/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/listener_manager.h"
#include "test/mocks/upstream/mocks.h"
#include "test/test_common/environment.h"
#include "test/test_common/utility.h"

#include "gmock/gmock.h"

using testing::_;
using testing::InSequence;
using testing::Invoke;
using testing::Return;
using testing::Throw;
using ::testing::_;
using ::testing::InSequence;
using ::testing::Invoke;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::Throw;

namespace Envoy {
namespace Server {
Expand Down
7 changes: 6 additions & 1 deletion test/server/listener_manager_impl_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
#include "server/listener_manager_impl.h"

#include "test/mocks/network/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/drain_manager.h"
#include "test/mocks/server/guard_dog.h"
#include "test/mocks/server/instance.h"
#include "test/mocks/server/listener_component_factory.h"
#include "test/mocks/server/worker.h"
#include "test/mocks/server/worker_factory.h"
#include "test/test_common/environment.h"
#include "test/test_common/simulated_time_system.h"
#include "test/test_common/test_runtime.h"
Expand Down
5 changes: 4 additions & 1 deletion test/server/server_fuzz_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
#include "test/common/runtime/utility.h"
#include "test/fuzz/fuzz_runner.h"
#include "test/integration/server.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/hot_restart.h"
#include "test/mocks/server/options.h"
#include "test/mocks/stats/mocks.h"
#include "test/test_common/environment.h"
#include "test/test_common/test_time.h"

namespace Envoy {
Expand Down
6 changes: 5 additions & 1 deletion test/server/server_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
#include "test/common/config/dummy_config.pb.h"
#include "test/common/stats/stat_test_utility.h"
#include "test/integration/server.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/bootstrap_extension_factory.h"
#include "test/mocks/server/hot_restart.h"
#include "test/mocks/server/instance.h"
#include "test/mocks/server/options.h"
#include "test/mocks/server/overload_manager.h"
#include "test/mocks/stats/mocks.h"
#include "test/test_common/environment.h"
#include "test/test_common/registry.h"
Expand Down
4 changes: 3 additions & 1 deletion test/server/worker_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#include "server/worker_impl.h"

#include "test/mocks/network/mocks.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/server/guard_dog.h"
#include "test/mocks/server/instance.h"
#include "test/mocks/server/overload_manager.h"
#include "test/mocks/thread_local/mocks.h"
#include "test/test_common/utility.h"

Expand Down

0 comments on commit e5d3f72

Please sign in to comment.