maedhroz commented on code in PR #2497:
URL: https://github.com/apache/cassandra/pull/2497#discussion_r2231979112


##########
test/unit/org/apache/cassandra/db/ImportTest.java:
##########
@@ -978,6 +969,50 @@ public void skipEmptyIndexChecksumOnSAITest() throws 
Throwable
         }
     }
 
+    private static void assertImportSuccessfull(ColumnFamilyStore cfs, 
SSTableImporter.Options options)
+    {
+        ToolRunner.ToolResult result = doImportWithNodetool(cfs, options);
+        result.assertOnCleanExit();
+        assertThat(result.getStderr()).doesNotContain("Some directories failed 
to import, check server logs for details");
+    }
+
+    private static ToolRunner.ToolResult assertImportFailed(ColumnFamilyStore 
cfs, SSTableImporter.Options options)
+    {
+        ToolRunner.ToolResult result = doImportWithNodetool(cfs, options);
+        assertNotEquals(0, result.getExitCode());
+        return result;
+    }
+
+    private static ToolRunner.ToolResult 
doImportWithNodetool(ColumnFamilyStore cfs, SSTableImporter.Options options)
+    {
+        List<String> args = new ArrayList<>();
+        args.add("import");
+        if (!options.resetLevel)
+            args.add("--keep-level");
+        if (!options.clearRepaired)
+            args.add("--keep-repaired");
+        if (!options.verifySSTables)
+            args.add("--no-verify");
+        if (!options.verifyTokens)
+            args.add("--no-tokens");
+        if (!options.invalidateCaches)
+            args.add("--no-invalidate-caches");
+        if (options.extendedVerify)
+            args.add("--extended-verify");
+        if (options.copyData)
+            args.add("--copy-data");
+        if (options.failOnMissingIndex)
+            args.add("--require-index-components");
+        if (!options.validateIndexChecksum)
+            args.add("--no-index-validation");
+
+        args.add(cfs.keyspace.getName());
+        args.add(cfs.getTableName());
+        args.addAll(options.srcPaths);
+
+        return  ToolRunner.invokeNodetoolInJvm(args.toArray(new String[0]));

Review Comment:
   ```suggestion
           return ToolRunner.invokeNodetoolInJvm(args.toArray(new String[0]));
   ```



-- 
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: pr-unsubscr...@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to