Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ public AddMountTableEntryResponse addMountTableEntry(
AddMountTableEntryResponse response =
AddMountTableEntryResponse.newInstance();
response.setStatus(status);
updateCacheAllRouters();
if (status) {
updateCacheAllRouters();
}
return response;
} else {
AddMountTableEntryResponse response =
Expand All @@ -139,7 +141,9 @@ public UpdateMountTableEntryResponse updateMountTableEntry(
UpdateMountTableEntryResponse response =
UpdateMountTableEntryResponse.newInstance();
response.setStatus(status);
updateCacheAllRouters();
if (status) {
updateCacheAllRouters();
}
return response;
} else {
UpdateMountTableEntryResponse response =
Expand Down Expand Up @@ -170,7 +174,9 @@ public RemoveMountTableEntryResponse removeMountTableEntry(
RemoveMountTableEntryResponse response =
RemoveMountTableEntryResponse.newInstance();
response.setStatus(status);
updateCacheAllRouters();
if (status) {
updateCacheAllRouters();
}
return response;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ public void testAddMountTable() throws Exception {
assertEquals(0, ToolRunner.run(admin, argv));
assertEquals(-1, ToolRunner.run(admin, argv));


stateStore.loadCache(MountTableStoreImpl.class, true);
verifyMountTableContents(src, dest);

GetMountTableEntriesRequest getRequest = GetMountTableEntriesRequest
.newInstance(src);
GetMountTableEntriesResponse getResponse = client.getMountTableManager()
Expand Down Expand Up @@ -207,6 +208,15 @@ public void testAddMountTable() throws Exception {
assertTrue(mountTable.isFaultTolerant());
}

private void verifyMountTableContents(String src, String dest) throws Exception {
String[] argv = new String[] {"-ls", "/"};
System.setOut(new PrintStream(out));
assertEquals(0, ToolRunner.run(admin, argv));
String response = out.toString();
assertTrue("The response should have " + src + ": " + response, response.contains(src));
assertTrue("The response should have " + dest + ": " + response, response.contains(dest));
}

@Test
public void testAddMountTableNotNormalized() throws Exception {
String nsId = "ns0";
Expand Down