From bddcab80e7f94ac6d70141a07af6688d03c7a57f Mon Sep 17 00:00:00 2001 From: Harvey Tuch Date: Mon, 13 Aug 2018 23:39:24 -0400 Subject: [PATCH] test: make YamlLoadFromStringFail less picky about error msg. 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 --- test/common/protobuf/utility_test.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/common/protobuf/utility_test.cc b/test/common/protobuf/utility_test.cc index 7251e516818ab..998ac2c37bd77 100644 --- a/test/common/protobuf/utility_test.cc +++ b/test/common/protobuf/utility_test.cc @@ -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) {