Skip to content

Commit

Permalink
Merge pull request #367 from meilisearch/update-tests
Browse files Browse the repository at this point in the history
Update dart version and checkout
  • Loading branch information
brunoocasali authored Dec 20, 2023
2 parents a8f7734 + 706302e commit 63fd758
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: ['3.0.0']
version: ['latest']
name: integration-tests (dart ${{ matrix.version }})
services:
meilisearch:
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 0 additions & 8 deletions test/models/test_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,10 @@ class TestMeiliSearchClient extends MeiliSearchClient {
}

Future<void> disposeUsedResources() async {
final indexesCopy = usedIndexes.toList();
await Future.wait([
_deleteUsedIndexes(),
_deleteUsedKeys(),
]);
if (indexesCopy.isNotEmpty) {
await _deleteTasksForDeletedIndexes(indexesCopy);
}
}

Future<void> _deleteUsedIndexes() async {
Expand All @@ -131,8 +127,4 @@ class TestMeiliSearchClient extends MeiliSearchClient {
),
);
}

Future<void> _deleteTasksForDeletedIndexes(List<String> indexes) async {
await deleteTasks(params: DeleteTasksQuery(indexUids: indexes));
}
}
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 63fd758

Please sign in to comment.