Coverage Report

Created: 2023-11-12 09:30

/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
326k
MockDetectorHostMonitor::MockDetectorHostMonitor() = default;
15
326k
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
287k
MockHealthCheckHostMonitor::MockHealthCheckHostMonitor() = default;
31
287k
MockHealthCheckHostMonitor::~MockHealthCheckHostMonitor() = default;
32
33
MockHostDescription::MockHostDescription()
34
    : address_(Network::Utility::resolveUrl("tcp://10.0.0.1:443")),
35
287k
      socket_factory_(new testing::NiceMock<Network::MockTransportSocketFactory>) {
36
287k
  ON_CALL(*this, hostname()).WillByDefault(ReturnRef(hostname_));
37
287k
  ON_CALL(*this, address()).WillByDefault(Return(address_));
38
287k
  ON_CALL(*this, outlierDetector()).WillByDefault(ReturnRef(outlier_detector_));
39
287k
  ON_CALL(*this, stats()).WillByDefault(ReturnRef(stats_));
40
287k
  ON_CALL(*this, loadMetricStats()).WillByDefault(ReturnRef(load_metric_stats_));
41
287k
  ON_CALL(*this, locality()).WillByDefault(ReturnRef(locality_));
42
287k
  ON_CALL(*this, cluster()).WillByDefault(ReturnRef(cluster_));
43
287k
  ON_CALL(*this, healthChecker()).WillByDefault(ReturnRef(health_checker_));
44
287k
  ON_CALL(*this, transportSocketFactory()).WillByDefault(ReturnRef(*socket_factory_));
45
287k
  ON_CALL(*this, canCreateConnection(_))
46
287k
      .WillByDefault(Invoke([this](Upstream::ResourcePriority pri) -> bool {
47
0
        return cluster().resourceManager(pri).connections().canCreate();
48
0
      }));
49
287k
}
50
51
287k
MockHostDescription::~MockHostDescription() = default;
52
53
39.6k
MockHostLight::MockHostLight() = default;
Envoy::Upstream::MockHostLight::MockHostLight()
Line
Count
Source
53
39.6k
MockHostLight::MockHostLight() = default;
Unexecuted instantiation: Envoy::Upstream::MockHostLight::MockHostLight()
54
39.6k
MockHostLight::~MockHostLight() = default;
55
56
39.6k
MockHost::MockHost() : socket_factory_(new testing::NiceMock<Network::MockTransportSocketFactory>) {
57
39.6k
  ON_CALL(*this, cluster()).WillByDefault(ReturnRef(cluster_));
58
39.6k
  ON_CALL(*this, outlierDetector()).WillByDefault(ReturnRef(outlier_detector_));
59
39.6k
  ON_CALL(*this, stats()).WillByDefault(ReturnRef(stats_));
60
39.6k
  ON_CALL(*this, loadMetricStats()).WillByDefault(ReturnRef(load_metric_stats_));
61
39.6k
  ON_CALL(*this, warmed()).WillByDefault(Return(true));
62
39.6k
  ON_CALL(*this, transportSocketFactory()).WillByDefault(ReturnRef(*socket_factory_));
63
39.6k
}
Unexecuted instantiation: Envoy::Upstream::MockHost::MockHost()
Envoy::Upstream::MockHost::MockHost()
Line
Count
Source
56
39.6k
MockHost::MockHost() : socket_factory_(new testing::NiceMock<Network::MockTransportSocketFactory>) {
57
39.6k
  ON_CALL(*this, cluster()).WillByDefault(ReturnRef(cluster_));
58
39.6k
  ON_CALL(*this, outlierDetector()).WillByDefault(ReturnRef(outlier_detector_));
59
39.6k
  ON_CALL(*this, stats()).WillByDefault(ReturnRef(stats_));
60
39.6k
  ON_CALL(*this, loadMetricStats()).WillByDefault(ReturnRef(load_metric_stats_));
61
39.6k
  ON_CALL(*this, warmed()).WillByDefault(Return(true));
62
39.6k
  ON_CALL(*this, transportSocketFactory()).WillByDefault(ReturnRef(*socket_factory_));
63
39.6k
}
64
65
39.6k
MockHost::~MockHost() = default;
66
67
} // namespace Upstream
68
} // namespace Envoy