Skip to content

Commit 98dd7c4

Browse files
nandakumar131xiaoyuyao
authored andcommitted
HDDS-1906. TestScmSafeMode#testSCMSafeModeRestrictedOp is failing. (#1260)
1 parent 6ff0453 commit 98dd7c4

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneCluster.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ void restartHddsDatanode(DatanodeDetails dn, boolean waitForDatanode)
226226
*/
227227
void startHddsDatanodes();
228228

229+
/**
230+
* Shuts down all the DataNodes.
231+
*/
232+
void shutdownHddsDatanodes();
233+
229234
/**
230235
* Builder class for MiniOzoneCluster.
231236
*/

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,17 @@ public void startHddsDatanodes() {
375375
});
376376
}
377377

378+
@Override
379+
public void shutdownHddsDatanodes() {
380+
hddsDatanodes.forEach((datanode) -> {
381+
try {
382+
shutdownHddsDatanode(datanode.getDatanodeDetails());
383+
} catch (IOException e) {
384+
LOG.error("Exception while trying to shutdown datanodes:", e);
385+
}
386+
});
387+
}
388+
378389
private CertificateClient getCAClient() {
379390
return this.caClient;
380391
}

hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmSafeMode.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
import java.util.List;
5959
import java.util.Map;
6060

61+
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_DEADNODE_INTERVAL;
62+
import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
6163
import static org.junit.Assert.assertFalse;
6264
import static org.junit.Assert.assertTrue;
6365
import static org.junit.Assert.fail;
@@ -91,6 +93,8 @@ public class TestScmSafeMode {
9193
@Before
9294
public void init() throws Exception {
9395
conf = new OzoneConfiguration();
96+
conf.set(OZONE_SCM_STALENODE_INTERVAL, "10s");
97+
conf.set(OZONE_SCM_DEADNODE_INTERVAL, "25s");
9498
builder = MiniOzoneCluster.newBuilder(conf)
9599
.setHbInterval(1000)
96100
.setHbProcessorInterval(500)
@@ -328,6 +332,8 @@ public void testSCMSafeModeRestrictedOp() throws Exception {
328332
}, 50, 1000 * 30);
329333
assertTrue(clientProtocolServer.getSafeModeStatus());
330334

335+
cluster.shutdownHddsDatanodes();
336+
Thread.sleep(30000);
331337
LambdaTestUtils.intercept(SCMException.class,
332338
"Open container " + containers.get(0).getContainerID() + " "
333339
+ "doesn't have enough replicas to service this operation in Safe"

0 commit comments

Comments
 (0)