@Test
public void verifyGettingLatencyRecordsIsCheapWhenDisabled() throws Exception {

  // when latency tracker is disabled, we expect it to take time equivalent to checking a boolean value
  final double maxLatencyWhenDisabledMs = 1000;
  final double minLatencyWhenDisabledMs = 0;
  final long numTasks = 1000;
  long aggregateLatency = 0;
  AbfsPerfTracker abfsPerfTracker = new AbfsPerfTracker(accountName, filesystemName, false);
  List<Callable<Long>> tasks = new ArrayList<>();
  for (int i = 0; i < numTasks; i++) {
    tasks.add(() -> {
      Instant startGet = Instant.now();
      abfsPerfTracker.getClientLatency();
      long latencyGet = Duration.between(startGet, Instant.now()).toMillis();
      LOG.debug("Spent {} ms in retrieving latency record.", latencyGet);
      return latencyGet;
    });
  }
  for (Future<Long> fr: executorService.invokeAll(tasks)) {
    aggregateLatency += fr.get();
  }
  double averageRecordLatency = aggregateLatency / numTasks;
  assertThat(averageRecordLatency).describedAs("Average time for getting latency records should be bounded")
    .isBetween(minLatencyWhenDisabledMs, maxLatencyWhenDisabledMs);
}