dataform-co / dataform

Dataform is a framework for managing SQL based data operations in BigQuery
https://cloud.google.com/dataform/docs
Apache License 2.0
851 stars 163 forks source link

Restore ability to unit test views #1824

Closed bmagyarkuti closed 2 months ago

bmagyarkuti commented 2 months ago

Prior to release 3.0.1, it was possible to unit test views. For example:

test("test a view")
  .dataset("example_view")
  .input(
    "sample_data",
    "select 'hi' as col1, 1 as col2, 3.5 as col3, true as col4, date '2020-07-23' as col5"
  )
  .expect(
    "select 'hi' as col1, 1 as col2, 3.5 as col3, true as col4, date '2020-07-23' as col5"
  );

Such a unit test always fails after 3.0.1 (including 3.0.2). It produces the following error message: Dataset sample_data could not be found. This happens regardless of whether the view has been defined.

This PR re-introduces the ability to unit test views.

I'd like to nominate @Ekrekr as reviewer.

lveraszto commented 2 months ago

+1

bmagyarkuti commented 2 months ago

@Ekrekr I've incorporated both your suggested changes. Is there anything else I need to do before this can be merged?

Ekrekr commented 2 months ago

Thanks - I've run the tests and they're all good, I just need you to sign the CLA before I can merge.

barna-emarsys commented 2 months ago

@Ekrekr, when I accepted your suggested changes, you became a co-author on that commit, and your @gmail address seems to be missing a signed CLA, so it seems you now need to sign the CLA. Sorry about this, maybe it was a bad idea to use Github's built-in "accept changes" functionality, let me know if you have any ideas for a workaround.

Ekrekr commented 2 months ago

Huh weird, I see that too, but it also shows as me having already signed it when I follow the link. Will just merge through it!