timoninmaxim commented on code in PR #10438:
URL: https://github.com/apache/ignite/pull/10438#discussion_r1048190784
##########
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/cache/IdleVerify.java:
##########
@@ -323,7 +323,8 @@ private void cacheIdleVerifyDump(
*/
private void cacheIdleVerifyV2(
GridClient client,
- GridClientConfiguration clientCfg
+ GridClientConfiguration clientCfg,
+ IgniteLogger logger
Review Comment:
Please, add this param to javadoc
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerClusterByClassTest.java:
##########
@@ -490,6 +490,40 @@ public void testCacheIdleVerify() {
);
}
+ /** */
+ @Test
+ public void testCacheIdleVerifyDumpFile() throws IOException {
+ IgniteEx ignite = crd;
+
+ createCacheAndPreload(ignite, 100);
+
+ injectTestSystemOut();
+
+ HashSet<Integer> clearKeys = new HashSet<>(asList(1, 2, 3, 4, 5, 6));
+
+
ignite.context().cache().cache(DEFAULT_CACHE_NAME).clearLocallyAll(clearKeys,
true, true, true);
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
+
+ Pattern fileNamePattern = Pattern.compile("See log for additional
information. (.*)");
+ Matcher matcher = fileNamePattern.matcher(testOut.toString());
+
+ if (matcher.find()) {
+ String fileContent = new
String(Files.readAllBytes(Paths.get(matcher.group(1))));
+ String out = testOut.toString();
+
+ assertContains(log, out, fileContent);
+
+ String summaryStr = "Total:" + nl() +DEFAULT_CACHE_NAME + " (6)" +
nl() + "1,2,3,4,5,6" + nl();
+
+ assertContains(log, fileContent, "conflict partitions");
+ assertContains(log, fileContent, summaryStr);
+ }
+ else {
Review Comment:
Code blocks of single line shouldn't be wrapped in {}.
Please check our code guidelines here
https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines#CodingGuidelines-BracesandIndentation
##########
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/cache/IdleVerify.java:
##########
@@ -335,10 +336,13 @@ private void cacheIdleVerifyV2(
IdleVerifyResultV2 res = executeTask(client,
VisorIdleVerifyTaskV2.class, taskArg, clientCfg);
- logParsedArgs(taskArg, System.out::print);
- res.print(System.out::print, false);
+ logParsedArgs(taskArg, logger::info);
+
+ StringBuilder sb = new StringBuilder();
+ res.print(sb::append, false);
+ logger.info(sb.toString());
- if (F.isEmpty(res.exceptions()))
+ if (F.isEmpty(res.exceptions())&&!res.hasConflicts())
Review Comment:
Please add white spaces around `&&`. Please check our code guildelines
https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines#CodingGuidelines-Spacing
##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerClusterByClassTest.java:
##########
@@ -490,6 +490,40 @@ public void testCacheIdleVerify() {
);
}
+ /** */
+ @Test
+ public void testCacheIdleVerifyDumpFile() throws IOException {
+ IgniteEx ignite = crd;
+
+ createCacheAndPreload(ignite, 100);
+
+ injectTestSystemOut();
+
+ HashSet<Integer> clearKeys = new HashSet<>(asList(1, 2, 3, 4, 5, 6));
+
+
ignite.context().cache().cache(DEFAULT_CACHE_NAME).clearLocallyAll(clearKeys,
true, true, true);
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
+
+ Pattern fileNamePattern = Pattern.compile("See log for additional
information. (.*)");
+ Matcher matcher = fileNamePattern.matcher(testOut.toString());
+
+ if (matcher.find()) {
+ String fileContent = new
String(Files.readAllBytes(Paths.get(matcher.group(1))));
+ String out = testOut.toString();
+
+ assertContains(log, out, fileContent);
+
+ String summaryStr = "Total:" + nl() +DEFAULT_CACHE_NAME + " (6)" +
nl() + "1,2,3,4,5,6" + nl();
Review Comment:
missed a space before DEFAULT_CACHE_NAME
--
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]