From 27d75356777614f565f564e2bcfef7f6cb3579da Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Thu, 27 Jun 2019 13:37:12 -0700 Subject: [PATCH 1/8] runtime Signed-off-by: Jyoti Mahapatra --- test/tools/router_check/router.cc | 24 +++++++++++-- test/tools/router_check/router.h | 7 +++- .../test/config/Runtime.golden.proto.json | 34 +++++++++++++++++++ .../router_check/test/config/Runtime.yaml | 18 ++++++++++ test/tools/router_check/validation.proto | 3 ++ 5 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 test/tools/router_check/test/config/Runtime.golden.proto.json create mode 100644 test/tools/router_check/test/config/Runtime.yaml diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc index a8359d4a6cb4..8fb569b4be45 100644 --- a/test/tools/router_check/router.cc +++ b/test/tools/router_check/router.cc @@ -72,7 +72,7 @@ RouterCheckTool RouterCheckTool::create(const std::string& router_config_file) { auto factory_context = std::make_unique>(); auto config = std::make_unique(route_config, *factory_context, false); - + return RouterCheckTool(std::move(factory_context), std::move(config), std::move(stats), std::move(api)); } @@ -82,13 +82,19 @@ RouterCheckTool::RouterCheckTool( std::unique_ptr config, std::unique_ptr stats, Api::ApiPtr api) : factory_context_(std::move(factory_context)), config_(std::move(config)), - stats_(std::move(stats)), api_(std::move(api)) {} + stats_(std::move(stats)), api_(std::move(api)) { + EXPECT_CALL( + factory_context_->runtime_loader_.snapshot_, + featureEnabled(_, testing::An(), testing::An())) + .WillRepeatedly(testing::Invoke(this, &RouterCheckTool::runtimeMock)); + } // TODO(jyotima): Remove this code path once the json schema code path is deprecated. bool RouterCheckTool::compareEntriesInJson(const std::string& expected_route_json) { Json::ObjectSharedPtr loader = Json::Factory::loadFromFile(expected_route_json, *api_); + loader->validateSchema(Json::ToolSchema::routerCheckSchema()); - + bool no_failures = true; for (const Json::ObjectSharedPtr& check_config : loader->asObjectArray()) { headers_finalized_ = false; @@ -165,6 +171,7 @@ bool RouterCheckTool::compareEntries(const std::string& expected_routes) { bool no_failures = true; for (const envoy::RouterCheckToolSchema::ValidationItem& check_config : validation_config.tests()) { + active_runtime = check_config.input().runtime(); headers_finalized_ = false; ToolConfig tool_config = ToolConfig::create(check_config); tool_config.route_ = config_->route(*tool_config.headers_, tool_config.random_value_); @@ -396,6 +403,17 @@ bool RouterCheckTool::compareResults(const std::string& actual, const std::strin return false; } +bool RouterCheckTool::runtimeMock(const std::string& key, + testing::Unused, + testing::Unused) { + if(active_runtime.empty()) { + return false; + } + + + return active_runtime.compare(key) == 0; +} + Options::Options(int argc, char** argv) { TCLAP::CmdLine cmd("router_check_tool", ' ', "none", true); TCLAP::SwitchArg is_proto("p", "useproto", "Use Proto test file schema", cmd, false); diff --git a/test/tools/router_check/router.h b/test/tools/router_check/router.h index 5ff95f8c8efb..da3f2c4f9ed9 100644 --- a/test/tools/router_check/router.h +++ b/test/tools/router_check/router.h @@ -119,7 +119,7 @@ class RouterCheckTool : Logger::Loggable { bool compareCustomHeaderField(ToolConfig& tool_config, const std::string& field, const std::string& expected); bool compareCustomHeaderField(ToolConfig& tool_config, - const envoy::RouterCheckToolSchema::ValidationAssert& expecte); + const envoy::RouterCheckToolSchema::ValidationAssert& expected); /** * Compare the expected and actual route parameter values. Print out match details if details_ * flag is set. @@ -129,6 +129,10 @@ class RouterCheckTool : Logger::Loggable { */ bool compareResults(const std::string& actual, const std::string& expected, const std::string& test_type); + + bool runtimeMock(const std::string& key, + testing::Unused, + testing::Unused); bool headers_finalized_{false}; @@ -139,6 +143,7 @@ class RouterCheckTool : Logger::Loggable { std::unique_ptr config_; std::unique_ptr stats_; Api::ApiPtr api_; + std::string active_runtime; }; /** diff --git a/test/tools/router_check/test/config/Runtime.golden.proto.json b/test/tools/router_check/test/config/Runtime.golden.proto.json new file mode 100644 index 000000000000..faf08f3a6444 --- /dev/null +++ b/test/tools/router_check/test/config/Runtime.golden.proto.json @@ -0,0 +1,34 @@ +{ + "tests": [ + { + "test_name": "Test_1", + "input": { + "authority": "www.lyft.com", + "path": "/", + "method": "GET", + "ssl": true, + "internal": true + }, + "validate": { + "path_redirect": "", + "cluster_name": "www3" + } + }, + { + "test_name": "Test_2", + "input": { + "authority": "www.lyft.com", + "path": "/", + "method": "GET", + "ssl": true, + "internal": true, + "runtime": "runtime.key" + }, + "validate": { + "path_redirect": "", + "cluster_name": "www2" + } + } + ] + } + \ No newline at end of file diff --git a/test/tools/router_check/test/config/Runtime.yaml b/test/tools/router_check/test/config/Runtime.yaml new file mode 100644 index 000000000000..1b8f1353bbcb --- /dev/null +++ b/test/tools/router_check/test/config/Runtime.yaml @@ -0,0 +1,18 @@ +virtual_hosts: +- name: www2 + domains: + - www.lyft.com + routes: + - match: + prefix: / + runtime_fraction: + runtime_key: runtime.key + default_value: + numerator: 100 + denominator: HUNDRED + route: + cluster: www2 + - match: + prefix: / + route: + cluster: www3 \ No newline at end of file diff --git a/test/tools/router_check/validation.proto b/test/tools/router_check/validation.proto index b129e4ffa019..19ae9e1d2b51 100644 --- a/test/tools/router_check/validation.proto +++ b/test/tools/router_check/validation.proto @@ -65,6 +65,9 @@ message ValidationInput { // The “:authority”, “:path”, “:method”, “x-forwarded-proto”, and “x-envoy-internal” fields are // specified by the other config options and should not be set here. repeated envoy.api.v2.core.HeaderValue additional_headers = 8; + + // Enable a runtime flag + string runtime = 9; } // The validate object specifies the returned route parameters to match. From 5d6d42a4063b5bbff4bcd786e9d0574768e8ca5a Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Thu, 27 Jun 2019 13:44:26 -0700 Subject: [PATCH 2/8] runnewtest Signed-off-by: Jyoti Mahapatra --- test/tools/router_check/router.cc | 4 ++-- test/tools/router_check/test/route_tests.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc index 8fb569b4be45..295c83c50a9e 100644 --- a/test/tools/router_check/router.cc +++ b/test/tools/router_check/router.cc @@ -72,7 +72,7 @@ RouterCheckTool RouterCheckTool::create(const std::string& router_config_file) { auto factory_context = std::make_unique>(); auto config = std::make_unique(route_config, *factory_context, false); - + return RouterCheckTool(std::move(factory_context), std::move(config), std::move(stats), std::move(api)); } @@ -94,7 +94,7 @@ bool RouterCheckTool::compareEntriesInJson(const std::string& expected_route_jso Json::ObjectSharedPtr loader = Json::Factory::loadFromFile(expected_route_json, *api_); loader->validateSchema(Json::ToolSchema::routerCheckSchema()); - + bool no_failures = true; for (const Json::ObjectSharedPtr& check_config : loader->asObjectArray()) { headers_finalized_ = false; diff --git a/test/tools/router_check/test/route_tests.sh b/test/tools/router_check/test/route_tests.sh index b0e910b65064..366c23a73333 100755 --- a/test/tools/router_check/test/route_tests.sh +++ b/test/tools/router_check/test/route_tests.sh @@ -18,6 +18,7 @@ done # Testing expected matches using --useproto # --useproto needs the test schema as a validation.proto message. +TESTS+=("Runtime") for t in "${TESTS[@]}" do TEST_OUTPUT=$("${PATH_BIN}" "-c" "${PATH_CONFIG}/${t}.yaml" "-t" "${PATH_CONFIG}/${t}.golden.proto.json" "--details" "--useproto") From 51268c9b383c302939541c8406a7aad4caba36df Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Thu, 27 Jun 2019 13:50:40 -0700 Subject: [PATCH 3/8] fixformat Signed-off-by: Jyoti Mahapatra --- test/tools/router_check/router.cc | 19 ++++++++----------- test/tools/router_check/router.h | 6 ++---- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc index 295c83c50a9e..7d6d5bb3875f 100644 --- a/test/tools/router_check/router.cc +++ b/test/tools/router_check/router.cc @@ -83,16 +83,16 @@ RouterCheckTool::RouterCheckTool( Api::ApiPtr api) : factory_context_(std::move(factory_context)), config_(std::move(config)), stats_(std::move(stats)), api_(std::move(api)) { - EXPECT_CALL( - factory_context_->runtime_loader_.snapshot_, - featureEnabled(_, testing::An(), testing::An())) - .WillRepeatedly(testing::Invoke(this, &RouterCheckTool::runtimeMock)); - } + EXPECT_CALL(factory_context_->runtime_loader_.snapshot_, + featureEnabled(_, testing::An(), + testing::An())) + .WillRepeatedly(testing::Invoke(this, &RouterCheckTool::runtimeMock)); +} // TODO(jyotima): Remove this code path once the json schema code path is deprecated. bool RouterCheckTool::compareEntriesInJson(const std::string& expected_route_json) { Json::ObjectSharedPtr loader = Json::Factory::loadFromFile(expected_route_json, *api_); - + loader->validateSchema(Json::ToolSchema::routerCheckSchema()); bool no_failures = true; @@ -403,14 +403,11 @@ bool RouterCheckTool::compareResults(const std::string& actual, const std::strin return false; } -bool RouterCheckTool::runtimeMock(const std::string& key, - testing::Unused, - testing::Unused) { - if(active_runtime.empty()) { +bool RouterCheckTool::runtimeMock(const std::string& key, testing::Unused, testing::Unused) { + if (active_runtime.empty()) { return false; } - return active_runtime.compare(key) == 0; } diff --git a/test/tools/router_check/router.h b/test/tools/router_check/router.h index da3f2c4f9ed9..3aa7973a8f22 100644 --- a/test/tools/router_check/router.h +++ b/test/tools/router_check/router.h @@ -129,10 +129,8 @@ class RouterCheckTool : Logger::Loggable { */ bool compareResults(const std::string& actual, const std::string& expected, const std::string& test_type); - - bool runtimeMock(const std::string& key, - testing::Unused, - testing::Unused); + + bool runtimeMock(const std::string& key, testing::Unused, testing::Unused); bool headers_finalized_{false}; From f3d7f641d4289db006421901f1628aec6252a475 Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Thu, 27 Jun 2019 13:51:32 -0700 Subject: [PATCH 4/8] fixformat Signed-off-by: Jyoti Mahapatra --- test/tools/router_check/router.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc index 7d6d5bb3875f..fd130ede8eba 100644 --- a/test/tools/router_check/router.cc +++ b/test/tools/router_check/router.cc @@ -92,7 +92,6 @@ RouterCheckTool::RouterCheckTool( // TODO(jyotima): Remove this code path once the json schema code path is deprecated. bool RouterCheckTool::compareEntriesInJson(const std::string& expected_route_json) { Json::ObjectSharedPtr loader = Json::Factory::loadFromFile(expected_route_json, *api_); - loader->validateSchema(Json::ToolSchema::routerCheckSchema()); bool no_failures = true; From 67e93dae5c5751e1c2d76194615a0deb9c6be142 Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Thu, 4 Jul 2019 12:24:45 -0700 Subject: [PATCH 5/8] add documents and runtime factor Signed-off-by: Jyoti Mahapatra --- .../root/configuration/tools/router_check.rst | 113 +++++++----------- .../install/tools/route_table_check_tool.rst | 3 - test/tools/router_check/router.cc | 18 ++- test/tools/router_check/router.h | 3 +- .../test/config/Runtime.golden.proto.json | 20 +++- .../router_check/test/config/Runtime.yaml | 2 +- 6 files changed, 75 insertions(+), 84 deletions(-) diff --git a/docs/root/configuration/tools/router_check.rst b/docs/root/configuration/tools/router_check.rst index fbbf2e8dda0b..739a634bca77 100644 --- a/docs/root/configuration/tools/router_check.rst +++ b/docs/root/configuration/tools/router_check.rst @@ -32,66 +32,38 @@ Validate A simple tool configuration json has one test case and is written as follows. The test expects a cluster name match of "instant-server".:: - [ - { - "test_name: "Cluster_name_test", - "input": - { - ":authority":"api.lyft.com", - ":path": "/api/locations" - }, - "validate": - { - "cluster_name": "instant-server" - } - } - ] - -.. code-block:: json - - [ - { - "test_name": "...", - "input": - { - ":authority": "...", - ":path": "...", - ":method": "...", - "internal" : "...", - "random_value" : "...", - "ssl" : "...", - "additional_headers": [ - { - "field": "...", - "value": "..." - }, - { - "..." - } - ] - }, - "validate": { - "cluster_name": "...", - "virtual_cluster_name": "...", - "virtual_host_name": "...", - "host_rewrite": "...", - "path_rewrite": "...", - "path_redirect": "...", - "header_fields" : [ - { - "field": "...", - "value": "..." - }, - { - "..." - } - ] - } - }, - { - "..." - } - ] + tests + - test_name: Cluster_name_test, + input: + authority: api.lyft.com, + path: /api/locations + validate: + cluster_name: instant-server + +.. code-block:: yaml + + tests + - test_name: "...", + input: + authority: ..., + path": ..., + method": ..., + internal" : ..., + random_value" : ..., + ssl" : ..., + - additional_headers: + key: ..., + value: ... + validate: + cluster_name: ..., + virtual_cluster_name: ..., + virtual_host_name: ..., + host_rewrite: ..., + path_rewrite: ..., + path_redirect: ..., + - header_fields: + key: ..., + value: ... test_name *(required, string)* The name of a test object. @@ -99,15 +71,15 @@ test_name input *(required, object)* Input values sent to the router that determine the returned route. - :authority + authority *(required, string)* The url authority. This value along with the path parameter define the url to be matched. An example authority value is "api.lyft.com". - :path + path *(required, string)* The url path. An example path value is "/foo". - :method - *(optional, string)* The request method. If not specified, the default method is GET. The options + method + *(required, string)* The request method. If not specified, the default method is GET. The options are GET, PUT, or POST. internal @@ -115,7 +87,8 @@ input If not specified, or if internal is equal to false, x-envoy-internal is not set. random_value - *(optional, integer)* An integer used to identify the target for weighted cluster selection. + *(optional, integer)* An integer used to identify the target for weighted cluster selection and + as a factor for the routing engine to decide whether a runtime based route takes effect. The default value of random_value is 0. ssl @@ -125,11 +98,11 @@ input x-forwarded-proto set to http. additional_headers - *(optional, array)* Additional headers to be added as input for route determination. The ":authority", - ":path", ":method", "x-forwarded-proto", and "x-envoy-internal" fields are specified by the other config + *(optional, array)* Additional headers to be added as input for route determination. The "authority", + "path", "method", "x-forwarded-proto", and "x-envoy-internal" fields are specified by the other config options and should not be set here. - field + key *(required, string)* The name of the header field to add. value @@ -159,11 +132,11 @@ validate *(optional, string)* Match the returned redirect path. header_fields - *(optional, array)* Match the listed header fields. Examples header fields include the ":path", "cookie", + *(optional, array)* Match the listed header fields. Examples header fields include the "path", "cookie", and "date" fields. The header fields are checked after all other test cases. Thus, the header fields checked will be those of the redirected or rewritten routes when applicable. - field + key *(required, string)* The name of the header field to match. value diff --git a/docs/root/install/tools/route_table_check_tool.rst b/docs/root/install/tools/route_table_check_tool.rst index 9210aae416c0..ac0b523eec09 100644 --- a/docs/root/install/tools/route_table_check_tool.rst +++ b/docs/root/install/tools/route_table_check_tool.rst @@ -67,9 +67,6 @@ Output locations ats cluster_name Test_6 - Testing with valid :ref:`runtime values ` is not currently supported, - this may be added in future work. - Building The tool can be built locally using Bazel. :: diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc index fd130ede8eba..ad8c5a7be203 100644 --- a/test/tools/router_check/router.cc +++ b/test/tools/router_check/router.cc @@ -83,10 +83,10 @@ RouterCheckTool::RouterCheckTool( Api::ApiPtr api) : factory_context_(std::move(factory_context)), config_(std::move(config)), stats_(std::move(stats)), api_(std::move(api)) { - EXPECT_CALL(factory_context_->runtime_loader_.snapshot_, - featureEnabled(_, testing::An(), - testing::An())) - .WillRepeatedly(testing::Invoke(this, &RouterCheckTool::runtimeMock)); + ON_CALL(factory_context_->runtime_loader_.snapshot_, + featureEnabled(_, testing::An(), + testing::An())) + .WillByDefault(testing::Invoke(this, &RouterCheckTool::runtimeMock)); } // TODO(jyotima): Remove this code path once the json schema code path is deprecated. @@ -402,12 +402,18 @@ bool RouterCheckTool::compareResults(const std::string& actual, const std::strin return false; } -bool RouterCheckTool::runtimeMock(const std::string& key, testing::Unused, testing::Unused) { +// The Mock for runtime value checks. +// This is a simple implementation to mimic the actual runtime checks at +// https://github.com/envoyproxy/envoy/blob/master/source/common/runtime/runtime_impl.cc#L250 +bool RouterCheckTool::runtimeMock(const std::string& key, + const envoy::type::FractionalPercent& default_value, + uint64_t random_value) { if (active_runtime.empty()) { return false; } - return active_runtime.compare(key) == 0; + return active_runtime.compare(key) == 0 && + ProtobufPercentHelper::evaluateFractionalPercent(default_value, random_value); } Options::Options(int argc, char** argv) { diff --git a/test/tools/router_check/router.h b/test/tools/router_check/router.h index 3aa7973a8f22..026bc1343a9a 100644 --- a/test/tools/router_check/router.h +++ b/test/tools/router_check/router.h @@ -130,7 +130,8 @@ class RouterCheckTool : Logger::Loggable { bool compareResults(const std::string& actual, const std::string& expected, const std::string& test_type); - bool runtimeMock(const std::string& key, testing::Unused, testing::Unused); + bool runtimeMock(const std::string& key, const envoy::type::FractionalPercent& default_value, + uint64_t random_value); bool headers_finalized_{false}; diff --git a/test/tools/router_check/test/config/Runtime.golden.proto.json b/test/tools/router_check/test/config/Runtime.golden.proto.json index faf08f3a6444..b5c116e0f6c5 100644 --- a/test/tools/router_check/test/config/Runtime.golden.proto.json +++ b/test/tools/router_check/test/config/Runtime.golden.proto.json @@ -10,7 +10,6 @@ "internal": true }, "validate": { - "path_redirect": "", "cluster_name": "www3" } }, @@ -22,10 +21,25 @@ "method": "GET", "ssl": true, "internal": true, - "runtime": "runtime.key" + "runtime": "runtime.key", + "random_value": 70 + }, + "validate": { + "cluster_name": "www3" + } + }, + { + "test_name": "Test_3", + "input": { + "authority": "www.lyft.com", + "path": "/", + "method": "GET", + "ssl": true, + "internal": true, + "runtime": "runtime.key", + "random_value": 20 }, "validate": { - "path_redirect": "", "cluster_name": "www2" } } diff --git a/test/tools/router_check/test/config/Runtime.yaml b/test/tools/router_check/test/config/Runtime.yaml index 1b8f1353bbcb..ad79c4cceaaf 100644 --- a/test/tools/router_check/test/config/Runtime.yaml +++ b/test/tools/router_check/test/config/Runtime.yaml @@ -8,7 +8,7 @@ virtual_hosts: runtime_fraction: runtime_key: runtime.key default_value: - numerator: 100 + numerator: 30 denominator: HUNDRED route: cluster: www2 From f001d3f8a73ee144d1a82b255d9674f35e5b3db5 Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Thu, 4 Jul 2019 12:39:53 -0700 Subject: [PATCH 6/8] fix typos Signed-off-by: Jyoti Mahapatra --- docs/root/configuration/tools/router_check.rst | 6 +++--- .../router_check/test/config/Runtime.golden.proto.json | 1 - test/tools/router_check/test/config/Runtime.yaml | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/root/configuration/tools/router_check.rst b/docs/root/configuration/tools/router_check.rst index 739a634bca77..7698430b03db 100644 --- a/docs/root/configuration/tools/router_check.rst +++ b/docs/root/configuration/tools/router_check.rst @@ -43,7 +43,7 @@ expects a cluster name match of "instant-server".:: .. code-block:: yaml tests - - test_name: "...", + - test_name: ..., input: authority: ..., path": ..., @@ -87,8 +87,8 @@ input If not specified, or if internal is equal to false, x-envoy-internal is not set. random_value - *(optional, integer)* An integer used to identify the target for weighted cluster selection and - as a factor for the routing engine to decide whether a runtime based route takes effect. + *(optional, integer)* An integer used to identify the target for weighted cluster selection + and as a factor for the routing engine to decide whether a runtime based route takes effect. The default value of random_value is 0. ssl diff --git a/test/tools/router_check/test/config/Runtime.golden.proto.json b/test/tools/router_check/test/config/Runtime.golden.proto.json index b5c116e0f6c5..e981f82c8a4f 100644 --- a/test/tools/router_check/test/config/Runtime.golden.proto.json +++ b/test/tools/router_check/test/config/Runtime.golden.proto.json @@ -45,4 +45,3 @@ } ] } - \ No newline at end of file diff --git a/test/tools/router_check/test/config/Runtime.yaml b/test/tools/router_check/test/config/Runtime.yaml index ad79c4cceaaf..2e91810912e3 100644 --- a/test/tools/router_check/test/config/Runtime.yaml +++ b/test/tools/router_check/test/config/Runtime.yaml @@ -15,4 +15,4 @@ virtual_hosts: - match: prefix: / route: - cluster: www3 \ No newline at end of file + cluster: www3 From 1b2ce7938b05192b52fbfed094ab35b7342a7e9b Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Thu, 4 Jul 2019 12:52:46 -0700 Subject: [PATCH 7/8] fix condition Signed-off-by: Jyoti Mahapatra --- test/tools/router_check/router.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc index ad8c5a7be203..3781e69cb909 100644 --- a/test/tools/router_check/router.cc +++ b/test/tools/router_check/router.cc @@ -408,11 +408,7 @@ bool RouterCheckTool::compareResults(const std::string& actual, const std::strin bool RouterCheckTool::runtimeMock(const std::string& key, const envoy::type::FractionalPercent& default_value, uint64_t random_value) { - if (active_runtime.empty()) { - return false; - } - - return active_runtime.compare(key) == 0 && + return !active_runtime.empty() && active_runtime.compare(key) == 0 && ProtobufPercentHelper::evaluateFractionalPercent(default_value, random_value); } From 472d918491003298bf3263955e6f1892232b5e1a Mon Sep 17 00:00:00 2001 From: Jyoti Mahapatra Date: Fri, 5 Jul 2019 10:51:09 -0700 Subject: [PATCH 8/8] comments Signed-off-by: Jyoti Mahapatra --- test/tools/router_check/router.cc | 3 +-- test/tools/router_check/validation.proto | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/tools/router_check/router.cc b/test/tools/router_check/router.cc index 3781e69cb909..74b1437fca59 100644 --- a/test/tools/router_check/router.cc +++ b/test/tools/router_check/router.cc @@ -403,8 +403,7 @@ bool RouterCheckTool::compareResults(const std::string& actual, const std::strin } // The Mock for runtime value checks. -// This is a simple implementation to mimic the actual runtime checks at -// https://github.com/envoyproxy/envoy/blob/master/source/common/runtime/runtime_impl.cc#L250 +// This is a simple implementation to mimic the actual runtime checks in Snapshot.featureEnabled bool RouterCheckTool::runtimeMock(const std::string& key, const envoy::type::FractionalPercent& default_value, uint64_t random_value) { diff --git a/test/tools/router_check/validation.proto b/test/tools/router_check/validation.proto index 19ae9e1d2b51..9c86153cd3e9 100644 --- a/test/tools/router_check/validation.proto +++ b/test/tools/router_check/validation.proto @@ -66,7 +66,9 @@ message ValidationInput { // specified by the other config options and should not be set here. repeated envoy.api.v2.core.HeaderValue additional_headers = 8; - // Enable a runtime flag + // Runtime setting key to enable for the test case. + // If a route depends on the runtime, the route will be enabled based on the random_value defined + // in the test. Only a random_value less than the fractional percentage will enable the route. string runtime = 9; }