You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2024/12/18 20:58:18 UTC

[PR] HDDS-11961. Improve existing repair tests [ozone]

adoroszlai opened a new pull request, #7595:
URL: https://github.com/apache/ozone/pull/7595

   ## What changes were proposed in this pull request?
   
   Code cleanup in `TestFSORepairTool`, `TestOzoneRepairShell`, and `TestTransactionInfoRepair`.
   
   - `TestOzoneRepairShell` should shutdown cluster, close client.
   - Reduce mocking.
   - Test `ozone repair`, not subcommands.
   - Less strict ordering of test cases in `TestFSORepairTool`.
   - Reduce duplication by extracting method for executing `ozone repair om fso-tree` with/without `--repair` flag.
   - Use static import for assertions.
   - Use `assertThat` instead of `assertTrue` where applicable, for better failure message.
   - Improve usability of `SystemOutCapturer`, `SystemErrCapturer` and reduce duplication.
   
   https://issues.apache.org/jira/browse/HDDS-11961
   
   ## How was this patch tested?
   
   https://github.com/adoroszlai/ozone/actions/runs/12399956746


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11961. Improve existing repair tests [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #7595:
URL: https://github.com/apache/ozone/pull/7595#issuecomment-2557049068

   Thanks @sarvekshayr, @sumitagrawl for the 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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11961. Improve existing repair tests [ozone]

Posted by "sarvekshayr (via GitHub)" <gi...@apache.org>.
sarvekshayr commented on code in PR #7595:
URL: https://github.com/apache/ozone/pull/7595#discussion_r1891198723


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/repair/om/TestFSORepairTool.java:
##########
@@ -137,81 +147,73 @@ public static void setup() throws Exception {
 
   @BeforeEach
   public void init() throws Exception {
-    System.setOut(new PrintStream(OUT, false, DEFAULT_ENCODING));
-    System.setErr(new PrintStream(ERR, false, DEFAULT_ENCODING));
+    out = GenericTestUtils.captureOut();
+    err = GenericTestUtils.captureErr();
   }
 
   @AfterEach
   public void clean() throws Exception {
     // reset stream after each unit test
-    OUT.reset();
-    ERR.reset();
-
-    // restore system streams
-    System.setOut(OLD_OUT);
-    System.setErr(OLD_ERR);
+    IOUtils.closeQuietly(out, err);
   }
 
   @AfterAll
   public static void reset() throws IOException {
-    if (cluster != null) {
-      cluster.shutdown();
-    }
-    if (client != null) {
-      client.close();
-    }
-    IOUtils.closeQuietly(fs);
+    IOUtils.closeQuietly(fs, client, cluster);
   }
 
   /**
    * Test to check a connected tree with one bucket.
    * The output remains the same in debug and repair mode as the tree is connected.
-   * @throws Exception
    */
-  @Order(1)
-  @Test
-  public void testConnectedTreeOneBucket() throws Exception {
+  @Order(ORDER_DRY_RUN)
+  @ParameterizedTest
+  @ValueSource(booleans = {true, false})
+  void testConnectedTreeOneBucket(boolean dryRun) {
     String expectedOutput = serializeReport(vol1Report);
 
     // Test the connected tree in debug mode.

Review Comment:
   nit: Remove the comment as this test is parameterized to handle both dryRun and repair modes.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-11961. Improve existing repair tests [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #7595:
URL: https://github.com/apache/ozone/pull/7595


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org