Check that metric values are consistent with TmpFileMgr state.
| 130 | |
| 131 | /// Check that metric values are consistent with TmpFileMgr state. |
| 132 | void CheckMetrics(TmpFileMgr* tmp_file_mgr) { |
| 133 | vector<TmpFileMgr::DeviceId> active = tmp_file_mgr->ActiveTmpDevices(); |
| 134 | IntGauge* active_metric = |
| 135 | metrics_->FindMetricForTesting<IntGauge>("tmp-file-mgr.active-scratch-dirs"); |
| 136 | EXPECT_EQ(active.size(), active_metric->GetValue()); |
| 137 | SetMetric<string>* active_set_metric = |
| 138 | metrics_->FindMetricForTesting<SetMetric<string>>( |
| 139 | "tmp-file-mgr.active-scratch-dirs.list"); |
| 140 | set<string> active_set = active_set_metric->value(); |
| 141 | EXPECT_EQ(active.size(), active_set.size()); |
| 142 | for (int i = 0; i < active.size(); ++i) { |
| 143 | string tmp_dir_path = tmp_file_mgr->GetTmpDirPath(active[i]); |
| 144 | EXPECT_TRUE(active_set.find(tmp_dir_path) != active_set.end()); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /// Check that current scratch space bytes and HWM match the expected values. |
| 149 | void checkHWMMetrics(int64_t exp_current_value, int64_t exp_hwm_value) { |
nothing calls this directly
no test coverage detected