LCOV - code coverage report
Current view: top level - source/server - proto_descriptors.cc (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 39 39 100.0 %
Date: 2024-01-05 06:35:25 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "source/server/proto_descriptors.h"
       2             : 
       3             : #include "source/common/common/assert.h"
       4             : #include "source/common/common/fmt.h"
       5             : #include "source/common/config/protobuf_link_hacks.h"
       6             : #include "source/common/protobuf/protobuf.h"
       7             : 
       8             : #include "absl/strings/str_cat.h"
       9             : 
      10             : namespace Envoy {
      11             : namespace Server {
      12             : 
      13         167 : void validateProtoDescriptors() {
      14         167 :   const auto methods = {
      15         167 :       "envoy.service.cluster.v3.ClusterDiscoveryService.FetchClusters",
      16         167 :       "envoy.service.cluster.v3.ClusterDiscoveryService.StreamClusters",
      17         167 :       "envoy.service.cluster.v3.ClusterDiscoveryService.DeltaClusters",
      18         167 :       "envoy.service.discovery.v3.AggregatedDiscoveryService.StreamAggregatedResources",
      19         167 :       "envoy.service.discovery.v3.AggregatedDiscoveryService.DeltaAggregatedResources",
      20         167 :       "envoy.service.endpoint.v3.EndpointDiscoveryService.FetchEndpoints",
      21         167 :       "envoy.service.endpoint.v3.EndpointDiscoveryService.StreamEndpoints",
      22         167 :       "envoy.service.endpoint.v3.EndpointDiscoveryService.DeltaEndpoints",
      23         167 :       "envoy.service.endpoint.v3.LocalityEndpointDiscoveryService.DeltaLocalityEndpoints",
      24         167 :       "envoy.service.health.v3.HealthDiscoveryService.FetchHealthCheck",
      25         167 :       "envoy.service.health.v3.HealthDiscoveryService.StreamHealthCheck",
      26         167 :       "envoy.service.listener.v3.ListenerDiscoveryService.FetchListeners",
      27         167 :       "envoy.service.listener.v3.ListenerDiscoveryService.StreamListeners",
      28         167 :       "envoy.service.listener.v3.ListenerDiscoveryService.DeltaListeners",
      29         167 :       "envoy.service.ratelimit.v3.RateLimitService.ShouldRateLimit",
      30         167 :       "envoy.service.route.v3.RouteDiscoveryService.FetchRoutes",
      31         167 :       "envoy.service.route.v3.RouteDiscoveryService.StreamRoutes",
      32         167 :       "envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes",
      33         167 :       "envoy.service.runtime.v3.RuntimeDiscoveryService.StreamRuntime",
      34         167 :       "envoy.service.runtime.v3.RuntimeDiscoveryService.FetchRuntime",
      35         167 :   };
      36             : 
      37        3340 :   for (const auto& method : methods) {
      38        3340 :     RELEASE_ASSERT(Protobuf::DescriptorPool::generated_pool()->FindMethodByName(method) != nullptr,
      39        3340 :                    absl::StrCat("Unable to find method descriptor for ", method));
      40        3340 :   }
      41             : 
      42         167 :   const auto types = {
      43         167 :       "envoy.config.cluster.v3.Cluster",     "envoy.config.endpoint.v3.ClusterLoadAssignment",
      44         167 :       "envoy.config.listener.v3.Listener",   "envoy.config.route.v3.RouteConfiguration",
      45         167 :       "envoy.config.route.v3.VirtualHost",   "envoy.extensions.transport_sockets.tls.v3.Secret",
      46         167 :       "envoy.config.endpoint.v3.LbEndpoint",
      47         167 :   };
      48             : 
      49        1169 :   for (const auto& type : types) {
      50        1169 :     RELEASE_ASSERT(Protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName(type) !=
      51        1169 :                        nullptr,
      52        1169 :                    absl::StrCat("Unable to find message type for ", type));
      53        1169 :   }
      54         167 : }
      55             : 
      56             : } // namespace Server
      57             : } // namespace Envoy

Generated by: LCOV version 1.15