From 16b854d770d6d215faa04a37692d80d3e67036a5 Mon Sep 17 00:00:00 2001 From: Bruno Casali Date: Wed, 20 Dec 2023 09:25:53 -0300 Subject: [PATCH 1/2] Update dart version and checkout --- .github/workflows/tests.yml | 6 +++--- bors.toml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e10934b0..6f74b8bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - version: ['3.0.0'] + version: ['latest'] name: integration-tests (dart ${{ matrix.version }}) services: meilisearch: @@ -82,10 +82,10 @@ jobs: name: check .code-samples.meilisearch.yaml runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 with: - sdk: '3.0.0' + sdk: 'latest' - name: check if samples changed run: | dart pub get diff --git a/bors.toml b/bors.toml index cc14a4c6..e714ecb3 100644 --- a/bors.toml +++ b/bors.toml @@ -1,7 +1,7 @@ status = [ - 'integration-tests (dart 3.0.0)', - 'linter-check', - 'pana' + 'integration-tests (dart latest)', + 'linter-check', + 'pana' ] # 1 hour timeout timeout-sec = 3600 From 706302eb6153c288d1f8a8a97d43aff314c28499 Mon Sep 17 00:00:00 2001 From: Bruno Casali Date: Wed, 20 Dec 2023 10:04:38 -0300 Subject: [PATCH 2/2] Fix swapIndexes flaky tests --- test/models/test_client.dart | 8 -------- test/swaps_test.dart | 13 ++++++++++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/test/models/test_client.dart b/test/models/test_client.dart index 7f8d0684..5f7a036d 100644 --- a/test/models/test_client.dart +++ b/test/models/test_client.dart @@ -108,14 +108,10 @@ class TestMeiliSearchClient extends MeiliSearchClient { } Future disposeUsedResources() async { - final indexesCopy = usedIndexes.toList(); await Future.wait([ _deleteUsedIndexes(), _deleteUsedKeys(), ]); - if (indexesCopy.isNotEmpty) { - await _deleteTasksForDeletedIndexes(indexesCopy); - } } Future _deleteUsedIndexes() async { @@ -131,8 +127,4 @@ class TestMeiliSearchClient extends MeiliSearchClient { ), ); } - - Future _deleteTasksForDeletedIndexes(List indexes) async { - await deleteTasks(params: DeleteTasksQuery(indexUids: indexes)); - } } diff --git a/test/swaps_test.dart b/test/swaps_test.dart index 58ba3260..6ffb2ee0 100644 --- a/test/swaps_test.dart +++ b/test/swaps_test.dart @@ -9,10 +9,15 @@ 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, @@ -20,10 +25,12 @@ void main() { ) .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}