From 21072606e4dd76e04a56b59770c0deb21bbde03c Mon Sep 17 00:00:00 2001 From: Frank Li Date: Tue, 28 Nov 2023 23:30:24 +0800 Subject: Added the test for UID field of NetwrokDnsEventReported atom Bug: 309575211 Test: atest resolv_unit_test, resolv_stats_test_utils_test statsd_testdrive Metrics dump: event_type: EVENT_GETADDRINFO, return_code: RC_EAI_NO_ERROR, latency_micros: 105375, hints_ai_flags: 1024, res_nsend_flags: -1, network_type: NT_CELLULAR, private_dns_modes: PDM_OPPORTUNISTIC, dns_query_events: { dns_query_event: [{ rcode: NS_R_NO_ERROR, type: NS_T_AAAA, cache_hit: CS_NOTFOUND, ip_version: IV_IPV6, protocol: PROTO_UDP, retry_times: 0, dns_server_index: 0, latency_micros: 98227, linux_errno: SYS_NO_ERROR },{ rcode: NS_R_NO_ERROR, type: NS_T_A, cache_hit: CS_NOTFOUND, ip_version: IV_IPV6, protocol: PROTO_UDP, retry_times: 0, dns_server_index: 0, latency_micros: 101843, linux_errno: SYS_NO_ERROR }] }, sampling_rate_denom: 400, uid: 10230 Change-Id: I113e1671ae28feed8751afd720743bc0f6745e3b --- tests/resolv_stats_test_utils.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/resolv_stats_test_utils.cpp') diff --git a/tests/resolv_stats_test_utils.cpp b/tests/resolv_stats_test_utils.cpp index 492080b8..1704922c 100644 --- a/tests/resolv_stats_test_utils.cpp +++ b/tests/resolv_stats_test_utils.cpp @@ -107,6 +107,8 @@ NetworkDnsEventReported fromNetworkDnsEventReportedStr(const std::string& str) { event.set_private_dns_modes(static_cast(value)); } else if (protoField[1] == "sampling_rate_denom" && ParseInt(protoField[2], &value)) { event.set_sampling_rate_denom(value); + } else if (protoField[1] == "uid" && ParseInt(protoField[2], &value)) { + event.set_uid(value); } } // Parsing each field of the proto DnsQueryEvent @@ -169,6 +171,7 @@ void PrintTo(const NetworkDnsEventReported& event, std::ostream* os) { *os << " network_type: " << event.network_type() << "\n"; *os << " private_dns_modes: " << event.private_dns_modes() << "\n"; *os << " dns_query_event_size: " << event.dns_query_events().dns_query_event_size() << "\n"; + *os << " uid: " << event.uid() << "\n"; *os << "}"; } -- cgit v1.2.3