adoroszlai commented on code in PR #8140:
URL: https://github.com/apache/ozone/pull/8140#discussion_r2009150785
##########
hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/repair/TestOzoneRepair.java:
##########
@@ -95,29 +94,6 @@ private static void
assertSubcommandOptionRecursively(CommandLine cmd) {
}
}
- @Test
- void testOzoneRepairWhenUserIsRemindedSystemUserAndDeclinesToProceed()
throws Exception {
- OzoneRepair ozoneRepair = new OzoneRepair();
- System.setIn(new ByteArrayInputStream("N".getBytes(DEFAULT_ENCODING)));
-
- int res = ozoneRepair.execute(new String[]{"om", "fso-tree", "--db",
"/dev/null"});
- assertThat(res).isNotEqualTo(CommandLine.ExitCode.OK);
- assertThat(err.toString(DEFAULT_ENCODING)).contains("Aborting command.");
- // prompt should contain the current user name as well
- assertThat(err.toString(DEFAULT_ENCODING)).contains("ATTENTION: Running as
user " + OZONE_USER);
- }
-
- @Test
- void testOzoneRepairWhenUserIsRemindedSystemUserAndAgreesToProceed() throws
Exception {
- OzoneRepair ozoneRepair = new OzoneRepair();
- System.setIn(new ByteArrayInputStream("y".getBytes(DEFAULT_ENCODING)));
-
- ozoneRepair.execute(new String[]{"om", "fso-tree", "--db", "/dev/null"});
- assertThat(out.toString(DEFAULT_ENCODING)).contains("Run as user: " +
OZONE_USER);
- // prompt should contain the current user name as well
- assertThat(err.toString(DEFAULT_ENCODING)).contains("ATTENTION: Running as
user " + OZONE_USER);
- }
-
Review Comment:
These tests should not be removed.
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/repair/RepairTool.java:
##########
@@ -53,8 +53,11 @@ protected Component serviceToBeOffline() {
@Override
public final Void call() throws Exception {
+ final Component service = serviceToBeOffline();
if (!dryRun) {
- confirmUser();
+ if (service == null) { // offline tool
+ confirmUser();
Review Comment:
`service == null` indicates online tool, doesn't it? So we should ask for
confirmation `if (!dryRun && service != null)`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]