Skip to content

Commit

Permalink
config: validate freebind and original-dst-cluster example configs. (e…
Browse files Browse the repository at this point in the history
…nvoyproxy#3015)

Signed-off-by: Harvey Tuch <[email protected]>
  • Loading branch information
htuch authored and mattklein123 committed Apr 6, 2018
1 parent fdcbe10 commit 34b87b6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
14 changes: 13 additions & 1 deletion configs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,26 @@ envoy_py_test_binary(
external_deps = ["jinja2"],
)

filegroup(
name = "configs",
srcs = [
"original-dst-cluster/proxy_config.json",
] + select({
"@bazel_tools//tools/osx:darwin": [],
"//conditions:default": ["freebind/freebind.yaml"],
}),
)

genrule(
name = "example_configs",
srcs = [
":configs",
"//examples:configs",
"//test/config/integration/certs",
],
outs = ["example_configs.tar"],
cmd = "$(location configgen.sh) $(location configgen) $(@D) $(locations //examples:configs) $(locations //test/config/integration/certs)",
cmd = "$(location configgen.sh) $(location configgen) $(@D) $(locations :configs) " +
"$(locations //examples:configs) $(locations //test/config/integration/certs)",
tools = [
"configgen.sh",
":configgen",
Expand Down
1 change: 1 addition & 0 deletions test/config_test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ envoy_cc_test_library(
"//test/integration:integration_lib",
"//test/mocks/server:server_mocks",
"//test/mocks/ssl:ssl_mocks",
"//test/test_common:threadsafe_singleton_injector_lib",
] + envoy_all_extensions(),
)
3 changes: 3 additions & 0 deletions test/config_test/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "test/integration/server.h"
#include "test/mocks/server/mocks.h"
#include "test/mocks/ssl/mocks.h"
#include "test/test_common/threadsafe_singleton_injector.h"
#include "test/test_common/utility.h"

#include "gmock/gmock.h"
Expand Down Expand Up @@ -83,6 +84,8 @@ class ConfigTest {
NiceMock<Server::MockWorkerFactory> worker_factory_;
Server::ListenerManagerImpl listener_manager_{server_, component_factory_, worker_factory_};
Runtime::RandomGeneratorImpl random_;
NiceMock<Api::MockOsSysCalls> os_sys_calls_;
TestThreadsafeSingletonInjector<Api::OsSysCallsImpl> os_calls{&os_sys_calls_};
};

void testMerge() {
Expand Down
7 changes: 6 additions & 1 deletion test/config_test/example_configs_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ TEST(ExampleConfigsTest, All) {
RELEASE_ASSERT(::getcwd(cwd, PATH_MAX) != nullptr);
RELEASE_ASSERT(::chdir(directory.c_str()) == 0);

EXPECT_EQ(26UL, ConfigTest::run(directory));
#ifdef __APPLE__
// freebind/freebind.yaml is not supported on OS X and disabled via Bazel.
EXPECT_EQ(27UL, ConfigTest::run(directory));
#else
EXPECT_EQ(28UL, ConfigTest::run(directory));
#endif
ConfigTest::testMerge();
ConfigTest::testIncompatibleMerge();

Expand Down

0 comments on commit 34b87b6

Please sign in to comment.