From 3b11c7018760bbdf405a89dc8917de28d0da02a4 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 16 Jul 2023 08:22:40 +0200 Subject: [PATCH 1/2] refactor(nextcloud): Remove test wrapping --- packages/nextcloud/test/core_test.dart | 9 ++++----- packages/nextcloud/test/news_test.dart | 18 +++++++++--------- packages/nextcloud/test/notes_test.dart | 9 ++++----- .../nextcloud/test/notifications_test.dart | 12 +++++++----- .../nextcloud/test/provisioning_api_test.dart | 9 ++++----- packages/nextcloud/test/uppush_test.dart | 9 ++++----- packages/nextcloud/test/user_status_test.dart | 9 ++++----- packages/nextcloud/test/webdav_test.dart | 9 ++++----- 8 files changed, 40 insertions(+), 44 deletions(-) diff --git a/packages/nextcloud/test/core_test.dart b/packages/nextcloud/test/core_test.dart index 18289abe..67ce619a 100644 --- a/packages/nextcloud/test/core_test.dart +++ b/packages/nextcloud/test/core_test.dart @@ -3,12 +3,11 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('core', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { diff --git a/packages/nextcloud/test/news_test.dart b/packages/nextcloud/test/news_test.dart index abf27e0b..0a82d7d1 100644 --- a/packages/nextcloud/test/news_test.dart +++ b/packages/nextcloud/test/news_test.dart @@ -6,15 +6,15 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('news', () { + late DockerImage image; late HttpServer rssServer; - setUpAll(() async => rssServer = await getRssServer()); - tearDownAll(() => rssServer.close(force: true)); + setUpAll(() async { + image = await getDockerImage(); + rssServer = await getRssServer(); + }); + tearDownAll(() async => rssServer.close(force: true)); late DockerContainer container; late TestNextcloudClient client; @@ -24,12 +24,12 @@ Future run(final DockerImage image) async { }); tearDown(() => container.destroy()); - Future addWikipediaFeed([final int? folderID]) => client.news.addFeed( + Future addWikipediaFeed([final int? folderID]) async => client.news.addFeed( url: 'http://host.docker.internal:${rssServer.port}/wikipedia.xml', folderId: folderID, ); - Future addNasaFeed() => client.news.addFeed( + Future addNasaFeed() async => client.news.addFeed( url: 'http://host.docker.internal:${rssServer.port}/nasa.xml', ); diff --git a/packages/nextcloud/test/notes_test.dart b/packages/nextcloud/test/notes_test.dart index f226b03a..3f00a6b0 100644 --- a/packages/nextcloud/test/notes_test.dart +++ b/packages/nextcloud/test/notes_test.dart @@ -3,12 +3,11 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('notes', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { diff --git a/packages/nextcloud/test/notifications_test.dart b/packages/nextcloud/test/notifications_test.dart index 414709f1..1f3b34e6 100644 --- a/packages/nextcloud/test/notifications_test.dart +++ b/packages/nextcloud/test/notifications_test.dart @@ -5,12 +5,11 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('notifications', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { @@ -99,6 +98,9 @@ Future run(final DockerImage image) async { }); group('push notifications', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { diff --git a/packages/nextcloud/test/provisioning_api_test.dart b/packages/nextcloud/test/provisioning_api_test.dart index ea8587df..26d6b963 100644 --- a/packages/nextcloud/test/provisioning_api_test.dart +++ b/packages/nextcloud/test/provisioning_api_test.dart @@ -2,12 +2,11 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('provisioning_api', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { diff --git a/packages/nextcloud/test/uppush_test.dart b/packages/nextcloud/test/uppush_test.dart index 02a4c11b..5da10188 100644 --- a/packages/nextcloud/test/uppush_test.dart +++ b/packages/nextcloud/test/uppush_test.dart @@ -2,12 +2,11 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('uppush', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { diff --git a/packages/nextcloud/test/user_status_test.dart b/packages/nextcloud/test/user_status_test.dart index d079ab8d..435c43d1 100644 --- a/packages/nextcloud/test/user_status_test.dart +++ b/packages/nextcloud/test/user_status_test.dart @@ -3,12 +3,11 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('user_status', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { diff --git a/packages/nextcloud/test/webdav_test.dart b/packages/nextcloud/test/webdav_test.dart index 0ab3632a..b1f72880 100644 --- a/packages/nextcloud/test/webdav_test.dart +++ b/packages/nextcloud/test/webdav_test.dart @@ -7,12 +7,11 @@ import 'package:test/test.dart'; import 'helper.dart'; -Future main() async { - await run(await getDockerImage()); -} - -Future run(final DockerImage image) async { +void main() { group('webdav', () { + late DockerImage image; + setUpAll(() async => image = await getDockerImage()); + late DockerContainer container; late TestNextcloudClient client; setUp(() async { From 47f95213f606016a2ec55d3b200b5aa0c2682447 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 16 Jul 2023 08:29:02 +0200 Subject: [PATCH 2/2] feat(nextcloud): Retry failed tests --- packages/nextcloud/test/core_test.dart | 3 +++ packages/nextcloud/test/news_test.dart | 3 +++ packages/nextcloud/test/notes_test.dart | 3 +++ packages/nextcloud/test/notifications_test.dart | 3 +++ packages/nextcloud/test/provisioning_api_test.dart | 3 +++ packages/nextcloud/test/uppush_test.dart | 3 +++ packages/nextcloud/test/user_status_test.dart | 3 +++ packages/nextcloud/test/webdav_test.dart | 3 +++ 8 files changed, 24 insertions(+) diff --git a/packages/nextcloud/test/core_test.dart b/packages/nextcloud/test/core_test.dart index 67ce619a..9f864c62 100644 --- a/packages/nextcloud/test/core_test.dart +++ b/packages/nextcloud/test/core_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library core_test; + import 'package:nextcloud/nextcloud.dart'; import 'package:test/test.dart'; diff --git a/packages/nextcloud/test/news_test.dart b/packages/nextcloud/test/news_test.dart index 0a82d7d1..22e0ee6f 100644 --- a/packages/nextcloud/test/news_test.dart +++ b/packages/nextcloud/test/news_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library news_test; + import 'dart:async'; import 'dart:io'; diff --git a/packages/nextcloud/test/notes_test.dart b/packages/nextcloud/test/notes_test.dart index 3f00a6b0..b78b11fe 100644 --- a/packages/nextcloud/test/notes_test.dart +++ b/packages/nextcloud/test/notes_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library notes_test; + import 'package:nextcloud/nextcloud.dart'; import 'package:test/test.dart'; diff --git a/packages/nextcloud/test/notifications_test.dart b/packages/nextcloud/test/notifications_test.dart index 1f3b34e6..8eba1e9a 100644 --- a/packages/nextcloud/test/notifications_test.dart +++ b/packages/nextcloud/test/notifications_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library notifications_test; + import 'dart:async'; import 'package:nextcloud/nextcloud.dart'; diff --git a/packages/nextcloud/test/provisioning_api_test.dart b/packages/nextcloud/test/provisioning_api_test.dart index 26d6b963..9383e9f7 100644 --- a/packages/nextcloud/test/provisioning_api_test.dart +++ b/packages/nextcloud/test/provisioning_api_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library provisioning_api_test; + import 'package:test/test.dart'; import 'helper.dart'; diff --git a/packages/nextcloud/test/uppush_test.dart b/packages/nextcloud/test/uppush_test.dart index 5da10188..7393ff9b 100644 --- a/packages/nextcloud/test/uppush_test.dart +++ b/packages/nextcloud/test/uppush_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library uppush_test; + import 'package:test/test.dart'; import 'helper.dart'; diff --git a/packages/nextcloud/test/user_status_test.dart b/packages/nextcloud/test/user_status_test.dart index 435c43d1..663c359b 100644 --- a/packages/nextcloud/test/user_status_test.dart +++ b/packages/nextcloud/test/user_status_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library user_status_test; + import 'package:nextcloud/nextcloud.dart'; import 'package:test/test.dart'; diff --git a/packages/nextcloud/test/webdav_test.dart b/packages/nextcloud/test/webdav_test.dart index b1f72880..25396a30 100644 --- a/packages/nextcloud/test/webdav_test.dart +++ b/packages/nextcloud/test/webdav_test.dart @@ -1,3 +1,6 @@ +@Retry(3) +library webdav_test; + import 'dart:convert'; import 'dart:io'; import 'dart:typed_data';