Skip to content

Commit 0714ca1

Browse files
committed
Merge branch 'mysql-8.0' into mysql-trunk
Change-Id: I2eba9746d5ff27ff13b4c24c72da67e0366819f4
2 parents 2933b82 + d6d6d54 commit 0714ca1

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

router/tests/helpers/rest_api_testutils.cc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@
2727
#include <thread>
2828

2929
#include <gmock/gmock.h>
30+
31+
#define RAPIDJSON_HAVE_STDSTRING
32+
3033
#ifdef RAPIDJSON_NO_SIZETYPEDEFINE
3134
#include "my_rapidjson_size_t.h"
3235
#endif
33-
3436
#include <rapidjson/document.h>
3537
#include <rapidjson/error/en.h>
38+
#include <rapidjson/writer.h>
39+
3640
#include "mysqlrouter/rest_client.h"
3741

3842
#include "rest_api_testutils.h"
@@ -370,6 +374,15 @@ static void verify_swagger_content(
370374
}
371375
}
372376

377+
static std::string to_string(const JsonDocument &json_doc) {
378+
rapidjson::StringBuffer buffer;
379+
rapidjson::PrettyWriter writer(buffer);
380+
381+
json_doc.Accept(writer);
382+
383+
return buffer.GetString();
384+
}
385+
373386
void RestApiComponentTest::fetch_and_validate_schema_and_resource(
374387
const RestApiTestParams &test_params, ProcessWrapper &http_server,
375388
const std::string &http_hostname) {
@@ -468,8 +481,8 @@ void RestApiComponentTest::fetch_and_validate_schema_and_resource(
468481
// HEAD does not return a body
469482
if (method != HttpMethod::Head) {
470483
for (const auto &kv : test_params.value_checks) {
471-
ASSERT_NO_FATAL_FAILURE(
472-
validate_value(json_doc, kv.first, kv.second));
484+
ASSERT_NO_FATAL_FAILURE(validate_value(json_doc, kv.first, kv.second))
485+
<< to_string(json_doc);
473486
}
474487
}
475488
}

0 commit comments

Comments
 (0)