Re: [PR] HDDS-15081. Add Internal Scaffold [ozone]

2026-05-01 Thread via GitHub


henrybear327 commented on PR #10146:
URL: https://github.com/apache/ozone/pull/10146#issuecomment-4361734920

   > Thanks @henrybear327 for the patch, @ivandika3 for creating the label!
   
   Thanks you both for the help and review!


-- 
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]



Re: [PR] HDDS-15081. Add Internal Scaffold [ozone]

2026-04-27 Thread via GitHub


peterxcli commented on PR #10146:
URL: https://github.com/apache/ozone/pull/10146#issuecomment-4332427431

   Thanks @henrybear327 for the patch, @ivandika3 for creating the label!


-- 
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]



Re: [PR] HDDS-15081. Add Internal Scaffold [ozone]

2026-04-27 Thread via GitHub


peterxcli merged PR #10146:
URL: https://github.com/apache/ozone/pull/10146


-- 
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]



Re: [PR] HDDS-15081. Add Internal Scaffold [ozone]

2026-04-27 Thread via GitHub


Copilot commented on code in PR #10146:
URL: https://github.com/apache/ozone/pull/10146#discussion_r3147766858


##
hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/local/TestOzoneLocal.java:
##
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.local;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import org.junit.jupiter.api.Test;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+/**
+ * Tests for {@link OzoneLocal}.
+ */
+class TestOzoneLocal {
+
+  @Test
+  void localCommandMetadataIsPresentAndHidden() {
+Command command = OzoneLocal.class.getAnnotation(Command.class);
+
+assertNotNull(command);
+assertEquals("ozone local", command.name());
+assertTrue(command.hidden());
+  }
+
+  @Test
+  void runCommandMetadataIsPresentAndHidden() {
+Command command = OzoneLocal.RunCommand.class.getAnnotation(Command.class);
+
+assertNotNull(command);
+assertEquals("run", command.name());
+assertTrue(command.hidden());
+  }
+
+  @Test
+  void genericCliRegistersRunPlaceholder() {
+OzoneLocal local = new OzoneLocal();
+
+assertTrue(local.getCmd().getSubcommands().containsKey("run"));
+  }
+
+  @Test
+  void rootHelpHidesRunPlaceholder() throws Exception {
+OzoneLocal local = new OzoneLocal();
+CommandLine commandLine = local.getCmd();
+ByteArrayOutputStream out = new ByteArrayOutputStream();
+ByteArrayOutputStream err = new ByteArrayOutputStream();
+commandLine.setOut(new PrintWriter(new OutputStreamWriter(out, UTF_8),
+true));
+commandLine.setErr(new PrintWriter(new OutputStreamWriter(err, UTF_8),
+true));
+
+int exitCode = local.execute(new String[] {"--help"});
+
+String help = out.toString(UTF_8.name());
+assertEquals(0, exitCode);
+assertTrue(help.contains("Usage: ozone local"));
+assertFalse(help.contains("run"));

Review Comment:
   The assertion `assertFalse(help.contains("run"))` is fairly broad and can 
become brittle if the root help text later includes the substring "run" for 
unrelated reasons (eg, wording like "running" / "runtime" in a description or 
option). Consider tightening this to check for a subcommand listing entry (eg, 
a line/section that specifically enumerates subcommands) or asserting via 
picocli metadata that the hidden subcommand is not rendered in the usage output.
   ```suggestion
   boolean runSubcommandListed = help.lines()
   .map(String::stripLeading)
   .anyMatch(line -> line.equals("run")
   || line.startsWith("run ")
   || line.startsWith("run\t"));
   assertEquals(0, exitCode);
   assertTrue(help.contains("Usage: ozone local"));
   assertFalse(runSubcommandListed);
   ```



-- 
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]