/** * Gets (and asserts) the value of the wasb_web_responses counter just * after the creation of the file system object. */ private long getBaseWebResponses() { // The number of requests should start at 0 return assertWebResponsesEquals(0, 0); }
@Test public void testMetricsOnMkdirList() throws Exception { long base = getBaseWebResponses(); // Create a directory assertTrue(fs.mkdirs(new Path("a"))); // At the time of writing // getAncestor uses 2 calls for each folder level /user/<name>/a // plus 1 call made by checkContainer // mkdir checks the hierarchy with 2 calls per level // mkdirs calls storeEmptyDir to create the empty folder, which makes 5 calls // For a total of 7 + 6 + 5 = 18 web responses base = assertWebResponsesInRange(base, 1, 18); assertEquals(1, AzureMetricsTestUtil.getLongCounterValue(getInstrumentation(), WASB_DIRECTORIES_CREATED)); // List the root contents assertEquals(1, getFileSystem().listStatus(new Path("/")).length); base = assertWebResponsesEquals(base, 1); assertNoErrors(); }