diff --git a/ex_cubic_ingestion/test/ex_cubic_ingestion/schema/cubic_load_test.exs b/ex_cubic_ingestion/test/ex_cubic_ingestion/schema/cubic_load_test.exs index d8b2a4f..7f5fd51 100644 --- a/ex_cubic_ingestion/test/ex_cubic_ingestion/schema/cubic_load_test.exs +++ b/ex_cubic_ingestion/test/ex_cubic_ingestion/schema/cubic_load_test.exs @@ -86,7 +86,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do dmap_table: dmap_table, dmap_load_objects: dmap_load_objects } do - {:ok, {nil, new_dmap_load_recs}} = + {:ok, {_table_original, nil, new_dmap_load_recs}} = CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) assert Enum.map(dmap_load_objects, & &1.key) == @@ -96,7 +96,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do load.s3_key end) - assert {:ok, {nil, []}} == + assert {:ok, {dmap_table, nil, []}} == CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) # add a new object @@ -111,7 +111,8 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do # adding one more load object, should only insert it as a load record assert {:ok, - {nil, [{%CubicLoad{s3_key: "cubic/dmap/sample/20220103.csv.gz"}, nil, _table, nil}]}} = + {_table_after_one_more_load, nil, + [{%CubicLoad{s3_key: "cubic/dmap/sample/20220103.csv.gz"}, nil, _table, nil}]}} = CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) end @@ -120,7 +121,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do ods_table: ods_table, ods_load_objects: ods_load_objects } do - {:ok, {_last_ods_table_snapshot, new_ods_load_recs}} = + {:ok, {_table_original, _last_ods_table_snapshot, new_ods_load_recs}} = CubicLoad.insert_new_from_objects_with_table(ods_load_objects, ods_table) assert Enum.map(ods_load_objects, & &1.key) == @@ -132,7 +133,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do end) # inserting again should not return any new records - assert {:ok, {_last_ods_table_snapshot, []}} = + assert {:ok, {_table_after_insert, _last_ods_table_snapshot, []}} = CubicLoad.insert_new_from_objects_with_table(ods_load_objects, ods_table) # add a new object @@ -147,7 +148,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do # adding one more load object, should only insert it as a load record assert {:ok, - {_last_ods_table_snapshot, + {_table_after_one_more_load, _last_ods_table_snapshot, [ {%CubicLoad{s3_key: "cubic/ods_qlik/SAMPLE/LOAD3.csv.gz"}, _ods_load_snapshot, _table, _ods_table_snapshot} @@ -157,7 +158,8 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do test "providing an empty list of objects", %{ dmap_table: dmap_table } do - assert {:ok, {nil, []}} = CubicLoad.insert_new_from_objects_with_table([], dmap_table) + assert {:ok, {_table, nil, []}} = + CubicLoad.insert_new_from_objects_with_table([], dmap_table) end end @@ -236,7 +238,8 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do dmap_load_objects: dmap_load_objects } do # insert records as ready - {:ok, {nil, [{first_new_load_rec, nil, _table, nil} | rest_new_load_recs]}} = + {:ok, + {_table_after_insert, nil, [{first_new_load_rec, nil, _table, nil} | rest_new_load_recs]}} = CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) # set the first record to 'archived' @@ -299,7 +302,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do dmap_load_objects: dmap_load_objects } do # insert records as ready - {:ok, {nil, [{first_new_load_rec, nil, _table, nil} | _rest]}} = + {:ok, {_table_after_insert, nil, [{first_new_load_rec, nil, _table, nil} | _rest]}} = CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) # update it to 'archived' status @@ -319,7 +322,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do dmap_load_objects: dmap_load_objects } do # insert records as ready - {:ok, {nil, new_load_recs}} = + {:ok, {_table_after_insert, nil, new_load_recs}} = CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) expected = @@ -346,7 +349,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do dmap_load_objects: dmap_load_objects } do # insert records as ready - {:ok, {nil, new_load_recs}} = + {:ok, {_table_after_insert, nil, new_load_recs}} = CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) new_load_rec_ids = @@ -368,7 +371,7 @@ defmodule ExCubicIngestion.Schema.CubicLoadTest do dmap_table: dmap_table, dmap_load_objects: dmap_load_objects } do - {:ok, {nil, new_load_recs}} = + {:ok, {_table, nil, new_load_recs}} = CubicLoad.insert_new_from_objects_with_table(dmap_load_objects, dmap_table) {_, ready_loads_by_table_query} =