forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mocks.h
66 lines (51 loc) · 2.07 KB
/
mocks.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include <cstdint>
#include <string>
#include <unordered_map>
#include "envoy/runtime/runtime.h"
#include "gmock/gmock.h"
namespace Envoy {
namespace Runtime {
class MockRandomGenerator : public RandomGenerator {
public:
MockRandomGenerator();
~MockRandomGenerator();
MOCK_METHOD0(random, uint64_t());
MOCK_METHOD0(uuid, std::string());
const std::string uuid_{"a121e9e1-feae-4136-9e0e-6fac343d56c9"};
};
class MockSnapshot : public Snapshot {
public:
MockSnapshot();
~MockSnapshot();
MOCK_CONST_METHOD2(featureEnabled, bool(const std::string& key, uint64_t default_value));
MOCK_CONST_METHOD3(featureEnabled,
bool(const std::string& key, uint64_t default_value, uint64_t random_value));
MOCK_CONST_METHOD4(featureEnabled, bool(const std::string& key, uint64_t default_value,
uint64_t random_value, uint64_t num_buckets));
MOCK_CONST_METHOD2(featureEnabled, bool(const std::string& key,
const envoy::type::FractionalPercent& default_value));
MOCK_CONST_METHOD3(featureEnabled, bool(const std::string& key,
const envoy::type::FractionalPercent& default_value,
uint64_t random_value));
MOCK_CONST_METHOD1(get, const std::string&(const std::string& key));
MOCK_CONST_METHOD2(getInteger, uint64_t(const std::string& key, uint64_t default_value));
MOCK_CONST_METHOD0(getLayers, const std::vector<OverrideLayerConstPtr>&());
};
class MockLoader : public Loader {
public:
MockLoader();
~MockLoader();
MOCK_METHOD0(snapshot, Snapshot&());
MOCK_METHOD1(mergeValues, void(const std::unordered_map<std::string, std::string>&));
testing::NiceMock<MockSnapshot> snapshot_;
};
class MockOverrideLayer : public Snapshot::OverrideLayer {
public:
MockOverrideLayer();
~MockOverrideLayer();
MOCK_CONST_METHOD0(name, const std::string&());
MOCK_CONST_METHOD0(values, const std::unordered_map<std::string, Snapshot::Entry>&());
};
} // namespace Runtime
} // namespace Envoy