Skip to content

Commit

Permalink
test: make YamlLoadFromStringFail less picky about error msg. (#4141)
Browse files Browse the repository at this point in the history
This failed during Google import, since it depended on protobuf library
internals. Made it more lenient while preserving semantics.

Risk level: Low
Testing: envoy OSS and Google internal.

Signed-off-by: Harvey Tuch <htuch@google.com>
  • Loading branch information
htuch authored Aug 14, 2018
1 parent c283439 commit a3c55bf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/common/protobuf/utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,9 @@ TEST(UtilityTest, YamlLoadFromStringFail) {
"Unable to convert YAML as JSON: /home/configs/config.yaml");
// Verify loadFromYaml throws error when the input leads to an Array. This error message is
// arguably more useful than only "Unable to convert YAML as JSON".
EXPECT_THROW_WITH_MESSAGE(MessageUtil::loadFromYaml("- node: { id: node1 }", bootstrap),
EnvoyException,
"Unable to parse JSON as proto (INVALID_ARGUMENT:: invalid name : Root "
"element must be a message.): [{\"node\":{\"id\":\"node1\"}}]");
EXPECT_THROW_WITH_REGEX(MessageUtil::loadFromYaml("- node: { id: node1 }", bootstrap),
EnvoyException,
"Unable to parse JSON as proto.*Root element must be a message.*");
}

TEST(DurationUtilTest, OutOfRange) {
Expand Down

0 comments on commit a3c55bf

Please sign in to comment.