15 #include <gtest/gtest.h>
16 #include <gutil/strings/substitute.h>
19 #include "gen-cpp/Status_types.h"
20 #include "gen-cpp/ErrorCodes_types.h"
25 ErrorMsg msg(TErrorCode::GENERAL,
"This is a test");
26 ASSERT_EQ(
"This is a test", msg.
msg());
30 ASSERT_EQ(
"This is a test\nDetail come here.\nOr here.\n",
33 msg =
ErrorMsg(TErrorCode::MISSING_BUILTIN,
"fun",
"sym");
34 ASSERT_EQ(
"Builtin 'fun' with symbol 'sym' does not exist. Verify that "
35 "all your impalads are the same version.", msg.msg());
40 left[TErrorCode::GENERAL].messages.push_back(
"1");
42 right[TErrorCode::GENERAL].messages.push_back(
"2");
43 right[TErrorCode::PARQUET_MULTIPLE_BLOCKS].messages.push_back(
"p");
44 right[TErrorCode::PARQUET_MULTIPLE_BLOCKS].count = 3;
47 ASSERT_EQ(2, left.size());
48 ASSERT_EQ(2, left[TErrorCode::GENERAL].messages.size());
51 right[TErrorCode::PARQUET_MULTIPLE_BLOCKS].messages.push_back(
"p");
52 right[TErrorCode::PARQUET_MULTIPLE_BLOCKS].count = 3;
55 ASSERT_EQ(2, left.size());
56 ASSERT_EQ(2, left[TErrorCode::GENERAL].messages.size());
57 ASSERT_EQ(6, left[TErrorCode::PARQUET_MULTIPLE_BLOCKS].
count);
63 m[TErrorCode::PARQUET_MULTIPLE_BLOCKS].messages.push_back(
"p");
64 m[TErrorCode::PARQUET_MULTIPLE_BLOCKS].count = 999;
66 m[TErrorCode::GENERAL].messages.push_back(
"1");
67 m[TErrorCode::GENERAL].messages.push_back(
"2");
85 left[TErrorCode::GENERAL].messages.push_back(
"1");
86 left[TErrorCode::GENERAL].messages.push_back(
"2");
87 left[TErrorCode::PARQUET_MULTIPLE_BLOCKS].messages.push_back(
"p");
88 left[TErrorCode::PARQUET_MULTIPLE_BLOCKS].count = 999;
94 int main(
int argc,
char **argv) {
95 ::testing::InitGoogleTest(&argc, argv);
96 return RUN_ALL_TESTS();
const std::string & msg() const
Returns the formatted error string.
string PrintErrorMapToString(const ErrorLogMap &errors)
void MergeErrorMaps(ErrorLogMap *left, const ErrorLogMap &right)
void AppendError(ErrorLogMap *map, const ErrorMsg &e)
int main(int argc, char **argv)
void AddDetail(const std::string &d)
Add detail string message.
size_t ErrorCount(const ErrorLogMap &errors)
std::string GetFullMessageDetails() const
std::map< TErrorCode::type, TErrorLogEntry > ErrorLogMap
Tracks log messages per error code.