Coverage Report

Created: 2024-09-19 09:45

/proc/self/cwd/test/mocks/upstream/host.cc
Line
Count
Source (jump to first uncovered line)
1
#include "test/mocks/upstream/host.h"
2
3
#include "source/common/network/utility.h"
4
5
using testing::_;
6
using testing::Invoke;
7
using testing::Return;
8
using testing::ReturnRef;
9
10
namespace Envoy {
11
namespace Upstream {
12
namespace Outlier {
13
14
327k
MockDetectorHostMonitor::MockDetectorHostMonitor() = default;
15
327k
MockDetectorHostMonitor::~MockDetectorHostMonitor() = default;
16
17
0
MockEventLogger::MockEventLogger() = default;
18
0
MockEventLogger::~MockEventLogger() = default;
19
20
0
MockDetector::MockDetector() {
21
0
  ON_CALL(*this, addChangedStateCb(_)).WillByDefault(Invoke([this](ChangeStateCb cb) -> void {
22
0
    callbacks_.push_back(cb);
23
0
  }));
24
0
}
25
26
0
MockDetector::~MockDetector() = default;
27
28
} // namespace Outlier
29
30
291k
MockHealthCheckHostMonitor::MockHealthCheckHostMonitor() = default;
31
291k
MockHealthCheckHostMonitor::~MockHealthCheckHostMonitor() = default;
32
33
MockHostDescription::MockHostDescription()
34
    : address_(*Network::Utility::resolveUrl("tcp://10.0.0.1:443")),
35
291k
      socket_factory_(new testing::NiceMock<Network::MockTransportSocketFactory>) {
36
291k
  ON_CALL(*this, hostname()).WillByDefault(ReturnRef(hostname_));
37
291k
  ON_CALL(*this, address()).WillByDefault(Return(address_));
38
291k
  ON_CALL(*this, outlierDetector()).WillByDefault(ReturnRef(outlier_detector_));
39
291k
  ON_CALL(*this, stats()).WillByDefault(ReturnRef(stats_));
40
291k
  ON_CALL(*this, loadMetricStats()).WillByDefault(ReturnRef(load_metric_stats_));
41
291k
  ON_CALL(*this, locality()).WillByDefault(ReturnRef(locality_));
42
291k
  ON_CALL(*this, cluster()).WillByDefault(ReturnRef(cluster_));
43
291k
  ON_CALL(*this, healthChecker()).WillByDefault(ReturnRef(health_checker_));
44
291k
  ON_CALL(*this, transportSocketFactory()).WillByDefault(ReturnRef(*socket_factory_));
45
291k
  ON_CALL(*this, canCreateConnection(_))
46
291k
      .WillByDefault(Invoke([this](Upstream::ResourcePriority pri) -> bool {
47
0
        return cluster().resourceManager(pri).connections().canCreate();
48
0
      }));
49
291k
}
50
51
291k
MockHostDescription::~MockHostDescription() = default;
52
53
36.7k
MockHostLight::MockHostLight() = default;
54
36.7k
MockHostLight::~MockHostLight() = default;
55
56
36.7k
MockHost::MockHost() : socket_factory_(new testing::NiceMock<Network::MockTransportSocketFactory>) {
57
36.7k
  ON_CALL(*this, cluster()).WillByDefault(ReturnRef(cluster_));
58
36.7k
  ON_CALL(*this, outlierDetector()).WillByDefault(ReturnRef(outlier_detector_));
59
36.7k
  ON_CALL(*this, stats()).WillByDefault(ReturnRef(stats_));
60
36.7k
  ON_CALL(*this, loadMetricStats()).WillByDefault(ReturnRef(load_metric_stats_));
61
36.7k
  ON_CALL(*this, warmed()).WillByDefault(Return(true));
62
36.7k
  ON_CALL(*this, transportSocketFactory()).WillByDefault(ReturnRef(*socket_factory_));
63
36.7k
}
Unexecuted instantiation: Envoy::Upstream::MockHost::MockHost()
Envoy::Upstream::MockHost::MockHost()
Line
Count
Source
56
36.7k
MockHost::MockHost() : socket_factory_(new testing::NiceMock<Network::MockTransportSocketFactory>) {
57
36.7k
  ON_CALL(*this, cluster()).WillByDefault(ReturnRef(cluster_));
58
36.7k
  ON_CALL(*this, outlierDetector()).WillByDefault(ReturnRef(outlier_detector_));
59
36.7k
  ON_CALL(*this, stats()).WillByDefault(ReturnRef(stats_));
60
36.7k
  ON_CALL(*this, loadMetricStats()).WillByDefault(ReturnRef(load_metric_stats_));
61
36.7k
  ON_CALL(*this, warmed()).WillByDefault(Return(true));
62
36.7k
  ON_CALL(*this, transportSocketFactory()).WillByDefault(ReturnRef(*socket_factory_));
63
36.7k
}
64
65
36.7k
MockHost::~MockHost() = default;
66
67
} // namespace Upstream
68
} // namespace Envoy