Skip to content

Commit

Permalink
Fix swapIndexes flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoocasali committed Dec 20, 2023
1 parent cbc52e9 commit bb8a90c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/swaps_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,28 @@ void main() {
setUpClient();

test('swaps indexes from input', () async {
var books = ['books', 'books_new'];
var movies = ['movies', 'movies_new'];
var books = [randomUid('books'), randomUid('books_new')];
var movies = [randomUid('movies'), randomUid('movies_new')];
var swaps = [SwapIndex(books), SwapIndex(movies)];

// first create the indexes to be swapped
for (var index in books + movies) {
await client.createIndex(index).waitFor(client: client);
}

var response = await client
.swapIndexes(
swaps,
deleteWhenDone: false,
)
.waitFor(
client: client,
throwFailed: false,
throwFailed: true,
);

expect(response.type, 'indexSwap');
expect(response.error, null);
expect(response.status, 'succeeded');
expect(response.details!['swaps'], [
{'indexes': books},
{'indexes': movies}
Expand Down

0 comments on commit bb8a90c

Please sign in to comment.