|
@@ -100,6 +100,8 @@ import static org.mockito.Mockito.any;
|
|
|
import static org.mockito.Mockito.anyString;
|
|
|
import static org.apache.hadoop.hdfs.DFSTestUtil.verifyFilesEqual;
|
|
|
import static org.apache.hadoop.test.GenericTestUtils.assertExceptionContains;
|
|
|
+import static org.apache.hadoop.test.MetricsAsserts.assertGauge;
|
|
|
+import static org.apache.hadoop.test.MetricsAsserts.getMetrics;
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
import static org.junit.Assert.assertFalse;
|
|
|
import static org.junit.Assert.assertNotEquals;
|
|
@@ -123,6 +125,7 @@ public class TestEncryptionZones {
|
|
|
protected DistributedFileSystem fs;
|
|
|
private File testRootDir;
|
|
|
protected final String TEST_KEY = "test_key";
|
|
|
+ private static final String NS_METRICS = "FSNamesystem";
|
|
|
|
|
|
protected FileSystemTestWrapper fsWrapper;
|
|
|
protected FileContextTestWrapper fcWrapper;
|
|
@@ -361,6 +364,9 @@ public class TestEncryptionZones {
|
|
|
fs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
|
|
|
cluster.restartNameNode(true);
|
|
|
assertNumZones(numZones);
|
|
|
+ assertEquals("Unexpected number of encryption zones!", numZones, cluster
|
|
|
+ .getNamesystem().getNumEncryptionZones());
|
|
|
+ assertGauge("NumEncryptionZones", numZones, getMetrics(NS_METRICS));
|
|
|
assertZonePresent(null, zone1.toString());
|
|
|
|
|
|
// Verify newly added ez is present after restarting the NameNode
|