From 06be2449216ef4a04f4a6e23c5f601fa7b47e420 Mon Sep 17 00:00:00 2001 From: Artur Pata Date: Tue, 4 Mar 2025 16:32:35 +0200 Subject: [PATCH] Fix oban option, split operations in CSV import export test --- test/plausible/imported/csv_importer_test.exs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/plausible/imported/csv_importer_test.exs b/test/plausible/imported/csv_importer_test.exs index 2c2f45734782..8b8bb9e5d150 100644 --- a/test/plausible/imported/csv_importer_test.exs +++ b/test/plausible/imported/csv_importer_test.exs @@ -351,7 +351,7 @@ defmodule Plausible.Imported.CSVImporterTest do storage: on_ee(do: "s3", else: "local") ) - assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false) + assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety: false) assert %SiteImport{ start_date: ~D[2011-12-25], @@ -414,7 +414,7 @@ defmodule Plausible.Imported.CSVImporterTest do storage: on_ee(do: "s3", else: "local") ) - assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false) + assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety: false) assert %SiteImport{ start_date: ~D[2021-12-30], @@ -484,7 +484,7 @@ defmodule Plausible.Imported.CSVImporterTest do storage: on_ee(do: "s3", else: "local") ) - assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false) + assert %{success: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety: false) assert %SiteImport{ start_date: ~D[2011-12-25], @@ -546,7 +546,7 @@ defmodule Plausible.Imported.CSVImporterTest do storage: on_ee(do: "s3", else: "local") ) - assert %{discard: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety?: false) + assert %{discard: 1} = Oban.drain_queue(queue: :analytics_imports, with_safety: false) # TODO # assert {:discard, message} = Plausible.Workers.ImportAnalytics.perform(job) @@ -1269,8 +1269,10 @@ defmodule Plausible.Imported.CSVImporterTest do end defp unzip_archive(%{tmp_dir: tmp_dir} = context) do + {:ok, binary} = :file.read_file(to_charlist(Path.join(tmp_dir, "plausible-export.zip"))) + assert {:ok, files} = - :zip.unzip(to_charlist(Path.join(tmp_dir, "plausible-export.zip")), + :zip.unzip(binary, cwd: to_charlist(tmp_dir) )