jacek-lewandowski commented on code in PR #2081:
URL: https://github.com/apache/cassandra/pull/2081#discussion_r1069243661
##########
test/unit/org/apache/cassandra/tools/StandaloneUpgraderOnSStablesTest.java:
##########
@@ -138,22 +138,58 @@ public void testUpgrade() throws Throwable
Keyspace.open("legacy_tables").getColumnFamilyStore("legacy_" +
legacyId + "_simple").loadNewSSTables();
}
+ @Test
+ public void testUpgradeSequence() throws Throwable
+ {
+ int startGeneration = LegacySSTableTest.generateMultipleTables(
legacyId );
+
+ String tableName = "legacy_" + legacyId + "_multiple";
+
+ List<String> origFiles = getSStableFiles("legacy_tables", tableName);
+ // verify that the files are not returned in the correct order.
+ Set<String> treeSet = new TreeSet<>();
+ treeSet.addAll( origFiles );
+ assertNotEquals( treeSet.toArray(), origFiles.toArray());
+
+ ToolResult tool = ToolRunner.invokeClass(StandaloneUpgrader.class,
+ "legacy_tables",
+ tableName);
+ System.out.println( tool.getStdout() );
+ Assertions.assertThat(tool.getStdout()).contains("Found 3 sstables
that need upgrading.");
+ Assertions.assertThat(tool.getStdout()).contains("legacy_tables/" +
tableName);
+ int[] loc = new int[3];
+ for (int i=0;i<3;i++) {
+ String fileName = String.format( "%s-%s-big-Data.db", legacyId,
startGeneration+i);
+ Assertions.assertThat(tool.getStdout()).contains(fileName);
+ loc[i] = tool.getStdout().lastIndexOf(fileName);
+ }
+ Assert.assertTrue( "Files processed out of sequence", loc[0] < loc[1]
);
Review Comment:
Use `Assertions.assertThat(loc).isSorted` or something like that from assertj
--
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]