fluent-plugin-kubernetes_metadata_filter 3.6.0 → 3.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/Rakefile +3 -4
- data/lib/fluent/plugin/filter_kubernetes_metadata.rb +307 -278
- data/lib/fluent/plugin/kubernetes_metadata_cache_strategy.rb +15 -11
- data/lib/fluent/plugin/kubernetes_metadata_common.rb +38 -40
- data/lib/fluent/plugin/kubernetes_metadata_stats.rb +5 -7
- data/lib/fluent/plugin/kubernetes_metadata_test_api_adapter.rb +39 -36
- data/lib/fluent/plugin/kubernetes_metadata_watch_namespaces.rb +15 -12
- data/lib/fluent/plugin/kubernetes_metadata_watch_pods.rb +18 -17
- metadata +4 -174
- data/.circleci/config.yml +0 -48
- data/.gitignore +0 -18
- data/.rubocop.yml +0 -57
- data/Gemfile +0 -9
- data/Gemfile.lock +0 -170
- data/fluent-plugin-kubernetes_metadata_filter.gemspec +0 -34
- data/lib/fluent/plugin/kubernetes_metadata_util.rb +0 -33
- data/test/cassettes/invalid_api_server_config.yml +0 -53
- data/test/cassettes/kubernetes_docker_metadata_annotations.yml +0 -205
- data/test/cassettes/kubernetes_docker_metadata_dotted_slashed_labels.yml +0 -197
- data/test/cassettes/kubernetes_get_api_v1.yml +0 -193
- data/test/cassettes/kubernetes_get_api_v1_using_token.yml +0 -195
- data/test/cassettes/kubernetes_get_namespace_default.yml +0 -72
- data/test/cassettes/kubernetes_get_namespace_default_using_token.yml +0 -71
- data/test/cassettes/kubernetes_get_pod.yml +0 -146
- data/test/cassettes/kubernetes_get_pod_container_init.yml +0 -145
- data/test/cassettes/kubernetes_get_pod_using_token.yml +0 -148
- data/test/cassettes/kubernetes_get_pod_with_ownerrefs.yml +0 -156
- data/test/cassettes/metadata_from_tag_and_journald_fields.yml +0 -153
- data/test/cassettes/metadata_from_tag_journald_and_kubernetes_fields.yml +0 -285
- data/test/cassettes/valid_kubernetes_api_server.yml +0 -55
- data/test/cassettes/valid_kubernetes_api_server_using_token.yml +0 -57
- data/test/helper.rb +0 -82
- data/test/plugin/test.token +0 -1
- data/test/plugin/test_cache_stats.rb +0 -33
- data/test/plugin/test_cache_strategy.rb +0 -194
- data/test/plugin/test_filter_kubernetes_metadata.rb +0 -851
- data/test/plugin/test_watch_namespaces.rb +0 -245
- data/test/plugin/test_watch_pods.rb +0 -344
- data/test/plugin/watch_test.rb +0 -76
@@ -1,285 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
|
3
|
-
# Kubernetes metadata
|
4
|
-
#
|
5
|
-
# Copyright 2015 Red Hat, Inc.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
---
|
20
|
-
http_interactions:
|
21
|
-
- request:
|
22
|
-
method: get
|
23
|
-
uri: https://localhost:8443/api/v1/namespaces/journald-namespace-name/pods/journald-pod-name
|
24
|
-
body:
|
25
|
-
encoding: US-ASCII
|
26
|
-
string: ''
|
27
|
-
headers:
|
28
|
-
Accept:
|
29
|
-
- "*/*; q=0.5, application/xml"
|
30
|
-
Accept-Encoding:
|
31
|
-
- gzip, deflate
|
32
|
-
User-Agent:
|
33
|
-
- Ruby
|
34
|
-
response:
|
35
|
-
status:
|
36
|
-
code: 200
|
37
|
-
message: OK
|
38
|
-
headers:
|
39
|
-
Content-Type:
|
40
|
-
- application/json
|
41
|
-
Date:
|
42
|
-
- Fri, 08 May 2015 10:35:37 GMT
|
43
|
-
Transfer-Encoding:
|
44
|
-
- chunked
|
45
|
-
body:
|
46
|
-
encoding: UTF-8
|
47
|
-
string: |-
|
48
|
-
{
|
49
|
-
"kind": "Pod",
|
50
|
-
"apiVersion": "v1",
|
51
|
-
"metadata": {
|
52
|
-
"name": "journald-pod-name",
|
53
|
-
"generateName": "journald-pod-name-",
|
54
|
-
"namespace": "journald-namespace-name",
|
55
|
-
"selfLink": "/api/v1/namespaces/journald-namespace-name/pods/journald-pod-name",
|
56
|
-
"uid": "5e1c1e27-b637-4e81-80b6-6d8a8c404d3b",
|
57
|
-
"resourceVersion": "122",
|
58
|
-
"creationTimestamp": "2015-05-08T09:22:42Z",
|
59
|
-
"labels": {
|
60
|
-
"component": "journald-test"
|
61
|
-
}
|
62
|
-
},
|
63
|
-
"spec": {
|
64
|
-
"containers": [
|
65
|
-
{
|
66
|
-
"name": "journald-container-name",
|
67
|
-
"image": "journald-container-image:latest",
|
68
|
-
"terminationMessagePath": "/dev/termination-log",
|
69
|
-
"imagePullPolicy": "IfNotPresent",
|
70
|
-
"capabilities": {}
|
71
|
-
}
|
72
|
-
],
|
73
|
-
"nodeName": "jimmi-redhat.localnet"
|
74
|
-
},
|
75
|
-
"status": {
|
76
|
-
"phase": "Running",
|
77
|
-
"Condition": [
|
78
|
-
{
|
79
|
-
"type": "Ready",
|
80
|
-
"status": "True"
|
81
|
-
}
|
82
|
-
],
|
83
|
-
"hostIP": "172.17.42.1",
|
84
|
-
"podIP": "172.17.0.8",
|
85
|
-
"containerStatuses": [
|
86
|
-
{
|
87
|
-
"name": "journald-container-name",
|
88
|
-
"state": {
|
89
|
-
"running": {
|
90
|
-
"startedAt": "2015-05-08T09:22:44Z"
|
91
|
-
}
|
92
|
-
},
|
93
|
-
"lastState": {},
|
94
|
-
"ready": true,
|
95
|
-
"restartCount": 0,
|
96
|
-
"image": "journald-container-image:latest",
|
97
|
-
"imageID": "docker://dda4c95705fb7050b701b10a7fe928ca5bc971a1dcb521ae3c339194cbf36b47",
|
98
|
-
"containerID": "docker://838350c64bacba968d39a30a50789b2795291fceca6ccbff55298671d46b0e3b"
|
99
|
-
}
|
100
|
-
]
|
101
|
-
}
|
102
|
-
}
|
103
|
-
http_version:
|
104
|
-
recorded_at: Fri, 08 May 2015 10:35:37 GMT
|
105
|
-
- request:
|
106
|
-
method: get
|
107
|
-
uri: https://localhost:8443/api/v1/namespaces/journald-namespace-name
|
108
|
-
body:
|
109
|
-
encoding: US-ASCII
|
110
|
-
string: ''
|
111
|
-
headers:
|
112
|
-
Accept:
|
113
|
-
- "*/*; q=0.5, application/xml"
|
114
|
-
Accept-Encoding:
|
115
|
-
- gzip, deflate
|
116
|
-
User-Agent:
|
117
|
-
- Ruby
|
118
|
-
response:
|
119
|
-
status:
|
120
|
-
code: 200
|
121
|
-
message: OK
|
122
|
-
headers:
|
123
|
-
Content-Type:
|
124
|
-
- application/json
|
125
|
-
Date:
|
126
|
-
- Fri, 08 May 2015 10:35:37 GMT
|
127
|
-
Transfer-Encoding:
|
128
|
-
- chunked
|
129
|
-
body:
|
130
|
-
encoding: UTF-8
|
131
|
-
string: |-
|
132
|
-
{
|
133
|
-
"kind": "Namespace",
|
134
|
-
"apiVersion": "v1",
|
135
|
-
"metadata": {
|
136
|
-
"name": "journald-namespace-name",
|
137
|
-
"selfLink": "/api/v1/namespaces/journald-namespace-name",
|
138
|
-
"uid": "8282888f-733f-4f23-a3d3-1fdfa3bdacf2",
|
139
|
-
"resourceVersion": "6",
|
140
|
-
"creationTimestamp": "2015-05-08T09:22:01Z"
|
141
|
-
},
|
142
|
-
"spec": {
|
143
|
-
"finalizers": [
|
144
|
-
"kubernetes"
|
145
|
-
]
|
146
|
-
},
|
147
|
-
"status": {
|
148
|
-
"phase": "Active"
|
149
|
-
}
|
150
|
-
}
|
151
|
-
http_version:
|
152
|
-
recorded_at: Fri, 08 May 2015 10:35:37 GMT
|
153
|
-
- request:
|
154
|
-
method: get
|
155
|
-
uri: https://localhost:8443/api/v1/namespaces/k8s-namespace-name/pods/k8s-pod-name
|
156
|
-
body:
|
157
|
-
encoding: US-ASCII
|
158
|
-
string: ''
|
159
|
-
headers:
|
160
|
-
Accept:
|
161
|
-
- "*/*; q=0.5, application/xml"
|
162
|
-
Accept-Encoding:
|
163
|
-
- gzip, deflate
|
164
|
-
User-Agent:
|
165
|
-
- Ruby
|
166
|
-
response:
|
167
|
-
status:
|
168
|
-
code: 200
|
169
|
-
message: OK
|
170
|
-
headers:
|
171
|
-
Content-Type:
|
172
|
-
- application/json
|
173
|
-
Date:
|
174
|
-
- Fri, 08 May 2015 10:35:37 GMT
|
175
|
-
Transfer-Encoding:
|
176
|
-
- chunked
|
177
|
-
body:
|
178
|
-
encoding: UTF-8
|
179
|
-
string: |-
|
180
|
-
{
|
181
|
-
"kind": "Pod",
|
182
|
-
"apiVersion": "v1",
|
183
|
-
"metadata": {
|
184
|
-
"name": "k8s-pod-name",
|
185
|
-
"generateName": "k8s-pod-name-",
|
186
|
-
"namespace": "k8s-namespace-name",
|
187
|
-
"selfLink": "/api/v1/namespaces/k8s-namespace-name/pods/k8s-pod-name",
|
188
|
-
"uid": "ebabf749-5fcd-4750-a3f0-aedd89476da8",
|
189
|
-
"resourceVersion": "122",
|
190
|
-
"creationTimestamp": "2015-05-08T09:22:42Z",
|
191
|
-
"labels": {
|
192
|
-
"component": "k8s-test"
|
193
|
-
}
|
194
|
-
},
|
195
|
-
"spec": {
|
196
|
-
"containers": [
|
197
|
-
{
|
198
|
-
"name": "k8s-container-name",
|
199
|
-
"image": "k8s-container-image:latest",
|
200
|
-
"terminationMessagePath": "/dev/termination-log",
|
201
|
-
"imagePullPolicy": "IfNotPresent",
|
202
|
-
"capabilities": {}
|
203
|
-
}
|
204
|
-
],
|
205
|
-
"nodeName": "jimmi-redhat.localnet"
|
206
|
-
},
|
207
|
-
"status": {
|
208
|
-
"phase": "Running",
|
209
|
-
"Condition": [
|
210
|
-
{
|
211
|
-
"type": "Ready",
|
212
|
-
"status": "True"
|
213
|
-
}
|
214
|
-
],
|
215
|
-
"hostIP": "172.17.42.1",
|
216
|
-
"podIP": "172.17.0.8",
|
217
|
-
"containerStatuses": [
|
218
|
-
{
|
219
|
-
"name": "k8s-container-name",
|
220
|
-
"state": {
|
221
|
-
"running": {
|
222
|
-
"startedAt": "2015-05-08T09:22:44Z"
|
223
|
-
}
|
224
|
-
},
|
225
|
-
"lastState": {},
|
226
|
-
"ready": true,
|
227
|
-
"restartCount": 0,
|
228
|
-
"image": "k8s-container-image:latest",
|
229
|
-
"imageID": "docker://d78c5217c41e9af08d37d9ae2cb070afa1fe3da6bc77bfb18879a8b4bfdf8a34",
|
230
|
-
"containerID": "docker://e463bc0d3ae38f5c89d92dca49b30e049e899799920b79d4d5f705acbe82ba95"
|
231
|
-
}
|
232
|
-
]
|
233
|
-
}
|
234
|
-
}
|
235
|
-
http_version:
|
236
|
-
recorded_at: Fri, 08 May 2015 10:35:37 GMT
|
237
|
-
- request:
|
238
|
-
method: get
|
239
|
-
uri: https://localhost:8443/api/v1/namespaces/k8s-namespace-name
|
240
|
-
body:
|
241
|
-
encoding: US-ASCII
|
242
|
-
string: ''
|
243
|
-
headers:
|
244
|
-
Accept:
|
245
|
-
- "*/*; q=0.5, application/xml"
|
246
|
-
Accept-Encoding:
|
247
|
-
- gzip, deflate
|
248
|
-
User-Agent:
|
249
|
-
- Ruby
|
250
|
-
response:
|
251
|
-
status:
|
252
|
-
code: 200
|
253
|
-
message: OK
|
254
|
-
headers:
|
255
|
-
Content-Type:
|
256
|
-
- application/json
|
257
|
-
Date:
|
258
|
-
- Fri, 08 May 2015 10:35:37 GMT
|
259
|
-
Transfer-Encoding:
|
260
|
-
- chunked
|
261
|
-
body:
|
262
|
-
encoding: UTF-8
|
263
|
-
string: |-
|
264
|
-
{
|
265
|
-
"kind": "Namespace",
|
266
|
-
"apiVersion": "v1",
|
267
|
-
"metadata": {
|
268
|
-
"name": "k8s-namespace-name",
|
269
|
-
"selfLink": "/api/v1/namespaces/k8s-namespace-name",
|
270
|
-
"uid": "8e0dc8fc-59f2-49f7-a3e2-ed0913e19d9f",
|
271
|
-
"resourceVersion": "6",
|
272
|
-
"creationTimestamp": "2015-05-08T09:22:01Z"
|
273
|
-
},
|
274
|
-
"spec": {
|
275
|
-
"finalizers": [
|
276
|
-
"kubernetes"
|
277
|
-
]
|
278
|
-
},
|
279
|
-
"status": {
|
280
|
-
"phase": "Active"
|
281
|
-
}
|
282
|
-
}
|
283
|
-
http_version:
|
284
|
-
recorded_at: Fri, 08 May 2015 10:35:37 GMT
|
285
|
-
recorded_with: VCR 2.9.3
|
@@ -1,55 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
|
3
|
-
# Kubernetes metadata
|
4
|
-
#
|
5
|
-
# Copyright 2015 Red Hat, Inc.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
---
|
20
|
-
http_interactions:
|
21
|
-
- request:
|
22
|
-
method: get
|
23
|
-
uri: https://localhost:8443/api
|
24
|
-
body:
|
25
|
-
encoding: US-ASCII
|
26
|
-
string: ''
|
27
|
-
headers:
|
28
|
-
Accept:
|
29
|
-
- "*/*; q=0.5, application/xml"
|
30
|
-
Accept-Encoding:
|
31
|
-
- gzip, deflate
|
32
|
-
User-Agent:
|
33
|
-
- Ruby
|
34
|
-
response:
|
35
|
-
status:
|
36
|
-
code: 200
|
37
|
-
message: OK
|
38
|
-
headers:
|
39
|
-
Content-Type:
|
40
|
-
- application/json
|
41
|
-
Date:
|
42
|
-
- Fri, 08 May 2015 10:13:54 GMT
|
43
|
-
Content-Length:
|
44
|
-
- '67'
|
45
|
-
body:
|
46
|
-
encoding: UTF-8
|
47
|
-
string: |-
|
48
|
-
{
|
49
|
-
"versions": [
|
50
|
-
"v1"
|
51
|
-
]
|
52
|
-
}
|
53
|
-
http_version:
|
54
|
-
recorded_at: Fri, 08 May 2015 10:13:54 GMT
|
55
|
-
recorded_with: VCR 2.9.3
|
@@ -1,57 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
|
3
|
-
# Kubernetes metadata
|
4
|
-
#
|
5
|
-
# Copyright 2015 Red Hat, Inc.
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
---
|
20
|
-
http_interactions:
|
21
|
-
- request:
|
22
|
-
method: get
|
23
|
-
uri: https://localhost:8443/api
|
24
|
-
body:
|
25
|
-
encoding: US-ASCII
|
26
|
-
string: ''
|
27
|
-
headers:
|
28
|
-
Accept:
|
29
|
-
- "*/*; q=0.5, application/xml"
|
30
|
-
Accept-Encoding:
|
31
|
-
- gzip, deflate
|
32
|
-
User-Agent:
|
33
|
-
- Ruby
|
34
|
-
Authorization:
|
35
|
-
- Bearer YzYyYzFlODMtODdhNS00ZTMyLWIzMmItNmY4NDc4OTI1ZWFh
|
36
|
-
response:
|
37
|
-
status:
|
38
|
-
code: 200
|
39
|
-
message: OK
|
40
|
-
headers:
|
41
|
-
Content-Type:
|
42
|
-
- application/json
|
43
|
-
Date:
|
44
|
-
- Fri, 08 May 2015 10:13:54 GMT
|
45
|
-
Content-Length:
|
46
|
-
- '67'
|
47
|
-
body:
|
48
|
-
encoding: UTF-8
|
49
|
-
string: |-
|
50
|
-
{
|
51
|
-
"versions": [
|
52
|
-
"v1"
|
53
|
-
]
|
54
|
-
}
|
55
|
-
http_version:
|
56
|
-
recorded_at: Fri, 08 May 2015 10:13:54 GMT
|
57
|
-
recorded_with: VCR 2.9.3
|
data/test/helper.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
|
5
|
-
# Kubernetes metadata
|
6
|
-
#
|
7
|
-
# Copyright 2015 Red Hat, Inc.
|
8
|
-
#
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
-
# you may not use this file except in compliance with the License.
|
11
|
-
# You may obtain a copy of the License at
|
12
|
-
#
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
-
#
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
require 'bundler/setup'
|
22
|
-
require 'codeclimate-test-reporter'
|
23
|
-
SimpleCov.start do
|
24
|
-
formatter SimpleCov::Formatter::MultiFormatter.new [
|
25
|
-
SimpleCov::Formatter::HTMLFormatter,
|
26
|
-
CodeClimate::TestReporter::Formatter
|
27
|
-
]
|
28
|
-
end
|
29
|
-
|
30
|
-
require 'rr'
|
31
|
-
require 'test/unit'
|
32
|
-
require 'test/unit/rr'
|
33
|
-
require 'fileutils'
|
34
|
-
require 'fluent/log'
|
35
|
-
require 'fluent/test'
|
36
|
-
require 'minitest/autorun'
|
37
|
-
require 'vcr'
|
38
|
-
require 'ostruct'
|
39
|
-
require 'fluent/plugin/filter_kubernetes_metadata'
|
40
|
-
require 'fluent/test/driver/filter'
|
41
|
-
require 'kubeclient'
|
42
|
-
|
43
|
-
require 'webmock/test_unit'
|
44
|
-
WebMock.disable_net_connect!
|
45
|
-
|
46
|
-
VCR.configure do |config|
|
47
|
-
config.cassette_library_dir = 'test/cassettes'
|
48
|
-
config.hook_into :webmock # or :fakeweb
|
49
|
-
config.ignore_hosts 'codeclimate.com'
|
50
|
-
end
|
51
|
-
|
52
|
-
unless defined?(Test::Unit::AssertionFailedError)
|
53
|
-
class Test::Unit::AssertionFailedError < StandardError
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def unused_port
|
58
|
-
s = TCPServer.open(0)
|
59
|
-
port = s.addr[1]
|
60
|
-
s.close
|
61
|
-
port
|
62
|
-
end
|
63
|
-
|
64
|
-
def ipv6_enabled?
|
65
|
-
require 'socket'
|
66
|
-
|
67
|
-
begin
|
68
|
-
TCPServer.open('::1', 0)
|
69
|
-
true
|
70
|
-
rescue StandardError
|
71
|
-
false
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# TEST_NAME='foo' ruby test_file.rb to run a single test case
|
76
|
-
if ENV['TEST_NAME']
|
77
|
-
(class << Test::Unit::TestCase; self; end).prepend(Module.new do
|
78
|
-
def test(name)
|
79
|
-
super if name == ENV['TEST_NAME']
|
80
|
-
end
|
81
|
-
end)
|
82
|
-
end
|
data/test/plugin/test.token
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
12345
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
|
5
|
-
# Kubernetes metadata
|
6
|
-
#
|
7
|
-
# Copyright 2015 Red Hat, Inc.
|
8
|
-
#
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
-
# you may not use this file except in compliance with the License.
|
11
|
-
# You may obtain a copy of the License at
|
12
|
-
#
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
-
#
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
require_relative '../helper'
|
22
|
-
|
23
|
-
class KubernetesMetadataCacheStatsTest < Test::Unit::TestCase
|
24
|
-
test 'watch stats' do
|
25
|
-
require 'lru_redux'
|
26
|
-
stats = KubernetesMetadata::Stats.new
|
27
|
-
stats.bump(:missed)
|
28
|
-
stats.bump(:deleted)
|
29
|
-
stats.bump(:deleted)
|
30
|
-
|
31
|
-
assert_equal('stats - deleted: 2, missed: 1', stats.to_s)
|
32
|
-
end
|
33
|
-
end
|