Skip to content

Commit

Permalink
fix: test on dry run
Browse files Browse the repository at this point in the history
  • Loading branch information
deryrahman committed Jul 11, 2024
1 parent 0c44beb commit 627da5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions task/bq2bq/executor/tests/test_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,11 @@ def test_single_partition_transform_2d_with_spillover(self, BigqueryServiceMock)

calls = [call(query=final_query_1, write_disposition=WriteDisposition.WRITE_TRUNCATE,
destination_table="bq_project.playground_dev.abcd$20190103",
dry_run=False,
allow_field_addition=False),
call(query=final_query_2, write_disposition=WriteDisposition.WRITE_TRUNCATE,
destination_table="bq_project.playground_dev.abcd$20190104",
dry_run=False,
allow_field_addition=False)]
bigquery_service.transform_load.assert_has_calls(calls, any_order=True)
self.assertEqual(len(bigquery_service.transform_load.call_args_list), len(calls))
Expand Down Expand Up @@ -242,9 +244,11 @@ def test_execute_dry_run(self, BigqueryServiceMock):
task = TableTransformation(bigquery_service, task_config, query, localized_start_time,
localized_end_time, dry_run, localized_execution_time)
task.transform()
bigquery_service.transform_load.assert_called_with(query=query,

final_query = "select count(1) from table where date >= '2019-01-01 00:00:00' and date < '2019-01-01 00:00:00'"
bigquery_service.transform_load.assert_called_with(query=final_query,
write_disposition=WriteDisposition.WRITE_TRUNCATE,
destination_table="bq_project.playground_dev.abcd$20190101",
destination_table="bq_project.playground_dev.abcd",
dry_run=True,
allow_field_addition=False)

Expand Down

0 comments on commit 627da5a

Please sign in to comment.