TrafficControllerTest: improve error declaration in dumpsysInvalidMaps

Test: atest TrafficControllerTest
Change-Id: Id2b2e8edefed615ccb3e94667bc91bc03e14ad81
This commit is contained in:
Hungming Chen
2022-06-09 11:33:43 +08:00
committed by Nucca Chen
parent 410bb12d5f
commit 56b9013bcb

View File

@@ -842,20 +842,25 @@ TEST_F(TrafficControllerTest, TestDumpsys) {
TEST_F(TrafficControllerTest, dumpsysInvalidMaps) { TEST_F(TrafficControllerTest, dumpsysInvalidMaps) {
makeTrafficControllerMapsInvalid(); makeTrafficControllerMapsInvalid();
const std::string kErrIterate = "print end with error: Get firstKey map -1 failed: "
"Bad file descriptor";
const std::string kErrReadRulesConfig = "read ownerMatch configure failed with error: "
"Read value of map -1 failed: Bad file descriptor";
const std::string kErrReadStatsMapConfig = "read stats map configure failed with error: "
"Read value of map -1 failed: Bad file descriptor";
std::vector<std::string> expectedLines = { std::vector<std::string> expectedLines = {
"mCookieTagMap print end with error: Get firstKey map -1 failed: Bad file descriptor", fmt::format("mCookieTagMap {}", kErrIterate),
"mUidCounterSetMap print end with error: Get firstKey map -1 failed: Bad file descriptor", fmt::format("mUidCounterSetMap {}", kErrIterate),
"mAppUidStatsMap print end with error: Get firstKey map -1 failed: Bad file descriptor", fmt::format("mAppUidStatsMap {}", kErrIterate),
"mStatsMapA print end with error: Get firstKey map -1 failed: Bad file descriptor", fmt::format("mStatsMapA {}", kErrIterate),
"mStatsMapB print end with error: Get firstKey map -1 failed: Bad file descriptor", fmt::format("mStatsMapB {}", kErrIterate),
"mIfaceIndexNameMap print end with error: Get firstKey map -1 failed: Bad file descriptor", fmt::format("mIfaceIndexNameMap {}", kErrIterate),
"mIfaceStatsMap print end with error: Get firstKey map -1 failed: Bad file descriptor", fmt::format("mIfaceStatsMap {}", kErrIterate),
"mConfigurationMap read ownerMatch configure failed with error: " fmt::format("mConfigurationMap {}", kErrReadRulesConfig),
"Read value of map -1 failed: Bad file descriptor", fmt::format("mConfigurationMap {}", kErrReadStatsMapConfig),
"mConfigurationMap read stats map configure failed with error: " fmt::format("mUidOwnerMap {}", kErrIterate),
"Read value of map -1 failed: Bad file descriptor", fmt::format("mUidPermissionMap {}", kErrIterate)};
"mUidOwnerMap print end with error: Get firstKey map -1 failed: Bad file descriptor",
"mUidPermissionMap print end with error: Get firstKey map -1 failed: Bad file descriptor"};
EXPECT_TRUE(expectDumpsysContains(expectedLines)); EXPECT_TRUE(expectDumpsysContains(expectedLines));
} }