chihsuan commented on code in PR #10600:
URL: https://github.com/apache/ozone/pull/10600#discussion_r3480515778
##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneDebugShell.java:
##########
@@ -208,27 +210,49 @@ private int runChunkInfoCommand(String volumeName, String
bucketName,
private int runChunkInfoAndVerifyPaths(String volumeName, String bucketName,
String keyName) throws Exception {
- int exitCode = 1;
- try (GenericTestUtils.SystemOutCapturer capture = new GenericTestUtils
- .SystemOutCapturer()) {
- exitCode = runChunkInfoCommand(volumeName, bucketName, keyName);
- Set<String> blockFilePaths = new HashSet<>();
- String output = capture.getOutput();
- ObjectMapper objectMapper = new ObjectMapper();
- // Parse the JSON array string into a JsonNode
- JsonNode jsonNode = objectMapper.readTree(output);
- JsonNode keyLocations = jsonNode.get("keyLocations").get(0);
- for (JsonNode element : keyLocations) {
- String fileName =
- element.get("file").toString();
- blockFilePaths.add(fileName);
- }
- // DN storage directories are set differently for each DN
- // in MiniOzoneCluster as datanode-0,datanode-1,datanode-2 which is why
- // we expect 3 paths here in the set.
- assertEquals(3, blockFilePaths.size());
+ AtomicInteger exitCode = new AtomicInteger(1);
+ AtomicInteger lastPathCount = new AtomicInteger(-1);
+ AtomicReference<Throwable> lastError = new AtomicReference<>();
Review Comment:
Thanks for the review! @chungen0126 Yeah, these aren't for thread-safety. I
picked `Atomic*` specifically because the lambda has to write
`exitCode`/diagnostics back out, and a plain `int`/`Throwable` can't be
reassigned inside a lambda so they need to be mutable holders.
Besides, I observed that `Atomic*` is the existing idiom for `waitFor`
holders in the repo (e.g. `TestSnapshotBackgroundServices`).
Open to changing it if you have any suggestions. Thanks!
--
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]