MCPcopy Create free account
hub / github.com/apache/mesos / verifyCacheMetrics

Method verifyCacheMetrics

src/tests/fetcher_cache_tests.cpp:260–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258
259
260void FetcherCacheTest::verifyCacheMetrics()
261{
262 JSON::Object metrics = Metrics();
263
264 ASSERT_EQ(
265 1u,
266 metrics.values.count("containerizer/fetcher/cache_size_total_bytes"));
267
268 // The total size is always given by the corresponding agent flag.
269 EXPECT_SOME_EQ(
270 flags.fetcher_cache_size.bytes(),
271 metrics.at<JSON::Number>("containerizer/fetcher/cache_size_total_bytes"));
272
273 Try<std::list<Path>> files = fetcherProcess->cacheFiles();
274 ASSERT_SOME(files);
275
276 Bytes used;
277
278 foreach (const auto& file, files.get()) {
279 Try<Bytes> size = os::stat::size(file);
280 ASSERT_SOME(size);
281
282 used += size.get();
283 }
284
285 ASSERT_EQ(
286 1u,
287 metrics.values.count("containerizer/fetcher/cache_size_used_bytes"));
288
289 // Verify that the used amount of cache is the total of the size of
290 // all the files in the cache.
291 EXPECT_SOME_EQ(
292 used.bytes(),
293 metrics.at<JSON::Number>("containerizer/fetcher/cache_size_used_bytes"));
294}
295
296
297void FetcherCacheTest::TearDown()

Callers

nothing calls this directly

Calls 4

cacheFilesMethod · 0.80
MetricsFunction · 0.70
countMethod · 0.45
bytesMethod · 0.45

Tested by

no test coverage detected