Coverage Report

Created: 2024-09-19 09:45

/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
35.3k
MockOptions::MockOptions(const std::string& config_path) : config_path_(config_path) {
19
35.3k
  ON_CALL(*this, concurrency()).WillByDefault(ReturnPointee(&concurrency_));
20
35.3k
  ON_CALL(*this, configPath()).WillByDefault(ReturnRef(config_path_));
21
35.3k
  ON_CALL(*this, configProto()).WillByDefault(ReturnRef(config_proto_));
22
35.3k
  ON_CALL(*this, configYaml()).WillByDefault(ReturnRef(config_yaml_));
23
35.3k
  ON_CALL(*this, allowUnknownStaticFields()).WillByDefault(Invoke([this] {
24
8.53k
    return allow_unknown_static_fields_;
25
8.53k
  }));
26
35.3k
  ON_CALL(*this, rejectUnknownDynamicFields()).WillByDefault(Invoke([this] {
27
8.53k
    return reject_unknown_dynamic_fields_;
28
8.53k
  }));
29
35.3k
  ON_CALL(*this, ignoreUnknownDynamicFields()).WillByDefault(Invoke([this] {
30
8.53k
    return ignore_unknown_dynamic_fields_;
31
8.53k
  }));
32
35.3k
  ON_CALL(*this, adminAddressPath()).WillByDefault(ReturnRef(admin_address_path_));
33
35.3k
  ON_CALL(*this, serviceClusterName()).WillByDefault(ReturnRef(service_cluster_name_));
34
35.3k
  ON_CALL(*this, serviceNodeName()).WillByDefault(ReturnRef(service_node_name_));
35
35.3k
  ON_CALL(*this, serviceZone()).WillByDefault(ReturnRef(service_zone_name_));
36
35.3k
  ON_CALL(*this, logLevel()).WillByDefault(Return(log_level_));
37
35.3k
  ON_CALL(*this, logPath()).WillByDefault(ReturnRef(log_path_));
38
35.3k
  ON_CALL(*this, restartEpoch()).WillByDefault(ReturnPointee(&hot_restart_epoch_));
39
35.3k
  ON_CALL(*this, hotRestartDisabled()).WillByDefault(ReturnPointee(&hot_restart_disabled_));
40
35.3k
  ON_CALL(*this, signalHandlingEnabled()).WillByDefault(ReturnPointee(&signal_handling_enabled_));
41
35.3k
  ON_CALL(*this, mutexTracingEnabled()).WillByDefault(ReturnPointee(&mutex_tracing_enabled_));
42
35.3k
  ON_CALL(*this, coreDumpEnabled()).WillByDefault(ReturnPointee(&core_dump_enabled_));
43
35.3k
  ON_CALL(*this, cpusetThreadsEnabled()).WillByDefault(ReturnPointee(&cpuset_threads_enabled_));
44
35.3k
  ON_CALL(*this, disabledExtensions()).WillByDefault(ReturnRef(disabled_extensions_));
45
35.3k
  ON_CALL(*this, toCommandLineOptions()).WillByDefault(Invoke([] {
46
0
    return std::make_unique<envoy::admin::v3::CommandLineOptions>();
47
0
  }));
48
35.3k
  ON_CALL(*this, socketPath()).WillByDefault(ReturnRef(socket_path_));
49
35.3k
  ON_CALL(*this, socketMode()).WillByDefault(ReturnPointee(&socket_mode_));
50
35.3k
  ON_CALL(*this, statsTags()).WillByDefault(ReturnRef(stats_tags_));
51
35.3k
}
52
53
35.3k
MockOptions::~MockOptions() = default;
54
55
} // namespace Server
56
} // namespace Envoy