Coverage Report

Created: 2023-11-12 09:30

/proc/self/cwd/test/mocks/server/options.cc
Line
Count
Source (jump to first uncovered line)
1
#include "options.h"
2
3
#include "envoy/admin/v3/server_info.pb.h"
4
5
#include "source/common/config/well_known_names.h"
6
7
#include "gmock/gmock.h"
8
#include "gtest/gtest.h"
9
10
namespace Envoy {
11
namespace Server {
12
13
using ::testing::Invoke;
14
using ::testing::Return;
15
using ::testing::ReturnPointee;
16
using ::testing::ReturnRef;
17
18
36.8k
MockOptions::MockOptions(const std::string& config_path) : config_path_(config_path) {
19
36.8k
  ON_CALL(*this, concurrency()).WillByDefault(ReturnPointee(&concurrency_));
20
36.8k
  ON_CALL(*this, configPath()).WillByDefault(ReturnRef(config_path_));
21
36.8k
  ON_CALL(*this, configProto()).WillByDefault(ReturnRef(config_proto_));
22
36.8k
  ON_CALL(*this, configYaml()).WillByDefault(ReturnRef(config_yaml_));
23
36.8k
  ON_CALL(*this, allowUnknownStaticFields()).WillByDefault(Invoke([this] {
24
9.52k
    return allow_unknown_static_fields_;
25
9.52k
  }));
26
36.8k
  ON_CALL(*this, rejectUnknownDynamicFields()).WillByDefault(Invoke([this] {
27
9.52k
    return reject_unknown_dynamic_fields_;
28
9.52k
  }));
29
36.8k
  ON_CALL(*this, ignoreUnknownDynamicFields()).WillByDefault(Invoke([this] {
30
9.52k
    return ignore_unknown_dynamic_fields_;
31
9.52k
  }));
32
36.8k
  ON_CALL(*this, adminAddressPath()).WillByDefault(ReturnRef(admin_address_path_));
33
36.8k
  ON_CALL(*this, serviceClusterName()).WillByDefault(ReturnRef(service_cluster_name_));
34
36.8k
  ON_CALL(*this, serviceNodeName()).WillByDefault(ReturnRef(service_node_name_));
35
36.8k
  ON_CALL(*this, serviceZone()).WillByDefault(ReturnRef(service_zone_name_));
36
36.8k
  ON_CALL(*this, logLevel()).WillByDefault(Return(log_level_));
37
36.8k
  ON_CALL(*this, logPath()).WillByDefault(ReturnRef(log_path_));
38
36.8k
  ON_CALL(*this, restartEpoch()).WillByDefault(ReturnPointee(&hot_restart_epoch_));
39
36.8k
  ON_CALL(*this, hotRestartDisabled()).WillByDefault(ReturnPointee(&hot_restart_disabled_));
40
36.8k
  ON_CALL(*this, signalHandlingEnabled()).WillByDefault(ReturnPointee(&signal_handling_enabled_));
41
36.8k
  ON_CALL(*this, mutexTracingEnabled()).WillByDefault(ReturnPointee(&mutex_tracing_enabled_));
42
36.8k
  ON_CALL(*this, coreDumpEnabled()).WillByDefault(ReturnPointee(&core_dump_enabled_));
43
36.8k
  ON_CALL(*this, cpusetThreadsEnabled()).WillByDefault(ReturnPointee(&cpuset_threads_enabled_));
44
36.8k
  ON_CALL(*this, disabledExtensions()).WillByDefault(ReturnRef(disabled_extensions_));
45
36.8k
  ON_CALL(*this, toCommandLineOptions()).WillByDefault(Invoke([] {
46
0
    return std::make_unique<envoy::admin::v3::CommandLineOptions>();
47
0
  }));
48
36.8k
  ON_CALL(*this, socketPath()).WillByDefault(ReturnRef(socket_path_));
49
36.8k
  ON_CALL(*this, socketMode()).WillByDefault(ReturnPointee(&socket_mode_));
50
36.8k
  ON_CALL(*this, statsTags()).WillByDefault(ReturnRef(stats_tags_));
51
36.8k
}
52
53
36.8k
MockOptions::~MockOptions() = default;
54
55
} // namespace Server
56
} // namespace Envoy