|
@@ -17,6 +17,7 @@
|
|
|
*/
|
|
|
package org.apache.hadoop.hdfs.server.namenode.ha;
|
|
|
|
|
|
+
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
|
|
import java.io.IOException;
|
|
@@ -34,6 +35,7 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
|
|
|
import org.apache.hadoop.hdfs.MiniDFSNNTopology;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
|
|
import org.apache.hadoop.io.IOUtils;
|
|
|
+import org.apache.hadoop.ipc.StandbyException;
|
|
|
import org.junit.After;
|
|
|
import org.junit.Before;
|
|
|
import org.junit.Test;
|
|
@@ -130,4 +132,17 @@ public class TestQuotasWithHA {
|
|
|
assertEquals(1, cs.getDirectoryCount());
|
|
|
assertEquals(0, cs.getFileCount());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Test that getContentSummary on Standby should should throw standby
|
|
|
+ * exception.
|
|
|
+ */
|
|
|
+ @Test(expected = StandbyException.class)
|
|
|
+ public void testgetContentSummaryOnStandby() throws Exception {
|
|
|
+ Configuration nn1conf =cluster.getConfiguration(1);
|
|
|
+ // just reset the standby reads to default i.e False on standby.
|
|
|
+ HAUtil.setAllowStandbyReads(nn1conf, false);
|
|
|
+ cluster.restartNameNode(1);
|
|
|
+ cluster.getNameNodeRpc(1).getContentSummary("/");
|
|
|
+ }
|
|
|
}
|