Coverage Report

Created: 2023-11-12 09:30

/proc/self/cwd/source/server/proto_descriptors.cc
Line
Count
Source
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
2.77k
void validateProtoDescriptors() {
14
2.77k
  const auto methods = {
15
2.77k
      "envoy.service.cluster.v3.ClusterDiscoveryService.FetchClusters",
16
2.77k
      "envoy.service.cluster.v3.ClusterDiscoveryService.StreamClusters",
17
2.77k
      "envoy.service.cluster.v3.ClusterDiscoveryService.DeltaClusters",
18
2.77k
      "envoy.service.discovery.v3.AggregatedDiscoveryService.StreamAggregatedResources",
19
2.77k
      "envoy.service.discovery.v3.AggregatedDiscoveryService.DeltaAggregatedResources",
20
2.77k
      "envoy.service.endpoint.v3.EndpointDiscoveryService.FetchEndpoints",
21
2.77k
      "envoy.service.endpoint.v3.EndpointDiscoveryService.StreamEndpoints",
22
2.77k
      "envoy.service.endpoint.v3.EndpointDiscoveryService.DeltaEndpoints",
23
2.77k
      "envoy.service.endpoint.v3.LocalityEndpointDiscoveryService.DeltaLocalityEndpoints",
24
2.77k
      "envoy.service.health.v3.HealthDiscoveryService.FetchHealthCheck",
25
2.77k
      "envoy.service.health.v3.HealthDiscoveryService.StreamHealthCheck",
26
2.77k
      "envoy.service.listener.v3.ListenerDiscoveryService.FetchListeners",
27
2.77k
      "envoy.service.listener.v3.ListenerDiscoveryService.StreamListeners",
28
2.77k
      "envoy.service.listener.v3.ListenerDiscoveryService.DeltaListeners",
29
2.77k
      "envoy.service.ratelimit.v3.RateLimitService.ShouldRateLimit",
30
2.77k
      "envoy.service.route.v3.RouteDiscoveryService.FetchRoutes",
31
2.77k
      "envoy.service.route.v3.RouteDiscoveryService.StreamRoutes",
32
2.77k
      "envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes",
33
2.77k
      "envoy.service.runtime.v3.RuntimeDiscoveryService.StreamRuntime",
34
2.77k
      "envoy.service.runtime.v3.RuntimeDiscoveryService.FetchRuntime",
35
2.77k
  };
36
37
55.4k
  for (const auto& method : methods) {
38
55.4k
    RELEASE_ASSERT(Protobuf::DescriptorPool::generated_pool()->FindMethodByName(method) != nullptr,
39
55.4k
                   absl::StrCat("Unable to find method descriptor for ", method));
40
55.4k
  }
41
42
2.77k
  const auto types = {
43
2.77k
      "envoy.config.cluster.v3.Cluster",     "envoy.config.endpoint.v3.ClusterLoadAssignment",
44
2.77k
      "envoy.config.listener.v3.Listener",   "envoy.config.route.v3.RouteConfiguration",
45
2.77k
      "envoy.config.route.v3.VirtualHost",   "envoy.extensions.transport_sockets.tls.v3.Secret",
46
2.77k
      "envoy.config.endpoint.v3.LbEndpoint",
47
2.77k
  };
48
49
19.4k
  for (const auto& type : types) {
50
19.4k
    RELEASE_ASSERT(Protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName(type) !=
51
19.4k
                       nullptr,
52
19.4k
                   absl::StrCat("Unable to find message type for ", type));
53
19.4k
  }
54
2.77k
}
55
56
} // namespace Server
57
} // namespace Envoy