File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
fdb-record-layer-core/src/test/java/com/apple/foundationdb/record
provider/foundationdb/keyspace Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,12 @@ class KeySpacePathImportDataTest {
5555 @ RegisterExtension
5656 final FDBDatabaseExtension dbExtension = new FDBDatabaseExtension ();
5757 private FDBDatabase database ;
58+ private List <FDBDatabase > databases ;
5859
5960 @ BeforeEach
6061 void setUp () {
61- database = dbExtension .getDatabase ();
62+ databases = dbExtension .getDatabases (2 );
63+ database = databases .get (0 );
6264 }
6365
6466 @ Test
@@ -395,8 +397,12 @@ private void copyData(final KeySpacePath path) {
395397 // Export the data
396398 final List <DataInKeySpacePath > exportedData = getExportedData (path );
397399
398- // Clear the data and import it back
399- clearPath (database , path );
400+ if (databases .size () > 1 ) {
401+ database = databases .get (1 );
402+ } else {
403+ // Clear the data and import it back
404+ clearPath (database , path );
405+ }
400406
401407 // Import the data
402408 importData (database , path , exportedData );
Original file line number Diff line number Diff line change 3636
3737import javax .annotation .Nonnull ;
3838import javax .annotation .Nullable ;
39+ import java .util .ArrayList ;
40+ import java .util .Collections ;
3941import java .util .HashMap ;
42+ import java .util .List ;
4043import java .util .Map ;
4144import java .util .Objects ;
4245import java .util .concurrent .Executor ;
46+ import java .util .stream .Collectors ;
4347
4448import static org .junit .jupiter .api .Assertions .assertEquals ;
4549
@@ -161,6 +165,12 @@ public FDBDatabase getDatabase(@Nullable String clusterFile) {
161165 });
162166 }
163167
168+ public List <FDBDatabase > getDatabases (int count ) {
169+ List <String > clusterFiles = new ArrayList <>(FDBTestEnvironment .allClusterFiles ());
170+ Collections .shuffle (clusterFiles );
171+ return clusterFiles .stream ().limit (count ).map (this ::getDatabase ).collect (Collectors .toList ());
172+ }
173+
164174 public void checkForOpenContexts () {
165175 for (final Map .Entry <String , FDBDatabase > clusterFileToDatabase : databases .entrySet ()) {
166176 assertEquals (0 , clusterFileToDatabase .getValue ().warnAndCloseOldTrackedOpenContexts (0 ),
You can’t perform that action at this time.
0 commit comments