From 0a8f97a164de5491ea5de8d68538412e15201c22 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 18 Dec 2022 12:53:23 +0100 Subject: [PATCH 1/3] nextcloud: Don't wait for container to be killed --- packages/nextcloud/test/helper.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/nextcloud/test/helper.dart b/packages/nextcloud/test/helper.dart index fe26cb19..c2bf6d1a 100644 --- a/packages/nextcloud/test/helper.dart +++ b/packages/nextcloud/test/helper.dart @@ -36,12 +36,14 @@ class DockerContainer { } } - Future destroy() => runExecutableArguments( - 'docker', - [ - 'kill', - id, - ], + void destroy() => unawaited( + runExecutableArguments( + 'docker', + [ + 'kill', + id, + ], + ), ); Future collectLogs() async { From c4bb01966e4c44420c82a818f3f5d74bfb27d9f9 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 18 Dec 2022 12:53:58 +0100 Subject: [PATCH 2/3] tool: Pre-populate user data to improve unit tests performance --- tool/Dockerfile.dev | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tool/Dockerfile.dev b/tool/Dockerfile.dev index a160112f..c869de07 100644 --- a/tool/Dockerfile.dev +++ b/tool/Dockerfile.dev @@ -15,4 +15,7 @@ RUN ./occ app:install news RUN ./occ app:install notes RUN ./occ app:enable password_policy +RUN (bash /entrypoint.sh apache2-foreground &) && \ + until curl -s -o /dev/null http://localhost/status.php; do true; done && \ + for user in admin user1 user2; do curl -u "$user:$user" -H "ocs-apirequest: true" -s -o /dev/null http://localhost/ocs/v2.php/cloud/user; done COPY --chown=www-data:www-data overlay /usr/src/nextcloud/ From 2754837932bc4733dd07cd028415a9b0b366dea5 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sun, 18 Dec 2022 16:03:44 +0100 Subject: [PATCH 3/3] nextcloud: Fix tests expecting recent modified dates --- packages/nextcloud/test/webdav.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nextcloud/test/webdav.dart b/packages/nextcloud/test/webdav.dart index f9753eb2..41e31f85 100644 --- a/packages/nextcloud/test/webdav.dart +++ b/packages/nextcloud/test/webdav.dart @@ -49,7 +49,7 @@ Future run(final DockerImage image) async { final file = files.singleWhere((final f) => f.name == 'Nextcloud.png'); expect(file.hasPreview, isTrue); expect(file.mimeType, 'image/png'); - expectDateInReasonableTimeRange(file.lastModified!, DateTime.now()); + expect(file.lastModified!.isBefore(DateTime.now()), isTrue); expect(file.size!, 50598); }); @@ -168,7 +168,7 @@ Future run(final DockerImage image) async { ); expect(file.hasPreview, isTrue); expect(file.mimeType, 'image/png'); - expectDateInReasonableTimeRange(file.lastModified!, DateTime.now()); + expect(file.lastModified!.isBefore(DateTime.now()), isTrue); expect(file.size!, 50598); });