dbt-labs / metricflow

MetricFlow allows you to define, build, and maintain metrics in code.
https://docs.getdbt.com/docs/build/about-metricflow
Other
1.14k stars 94 forks source link

[Bug] Using BigQuery service account to run tests opens browser windows #1370

Closed wouter closed 2 months ago

wouter commented 2 months ago

Is this a new bug in metricflow?

Current Behavior

When I run make test-bigquery, the tests seem to stall and then open multuple oauth browser windows to get authentication to access BigQuery. I have set MF_SQL_ENGINE_PASSWORD to a JSON string that contains a service account JSON file with the required keys.

Expected Behavior

I expected the tests to run without having to authenticate using the service account credentials and not with my personal user credentials using the browser authentication method.

Steps To Reproduce

  1. Clone metricflow repository
  2. Set MF_SQL_ENGINE_PASSWORD to the JSON file of a Google Cloud service account that has access to BigQuery
  3. Set MF_SQL_ENGINE_URL to bigquery://
  4. Run make test-bigquery
  5. Wait until test workers start running, then stalling, then opening several tabs in my browser to authenticate to Google Cloud

Relevant log output

hatch -v run bigquery-env:pytest -vv -n auto  tests_metricflow/
─────────────────────────────────────────────────────────────────────────────────────────────────── bigquery-env ────────────────────────────────────────────────────────────────────────────────────────────────────
Finished polling dependency state
cmd [1] | pytest -vv -n auto tests_metricflow/
================================================================================================ test session starts ================================================================================================
platform darwin -- Python 3.9.6, pytest-8.3.2, pluggy-1.5.0 -- /Users/wouter/Library/Application Support/hatch/env/virtual/metricflow/WljpfXEy/bigquery-env/bin/python
cachedir: .pytest_cache
rootdir: /Users/wouter/Research/metricflow
configfile: pyproject.toml
plugins: mock-3.14.0, xdist-3.6.1
8 workers [702 items]
scheduling tests via LoadScheduling

tests_metricflow/cli/test_cli.py::test_query
tests_metricflow/dataflow/builder/test_dataflow_plan_builder.py::test_primary_entity_dimension
tests_metricflow/dataflow/builder/test_dataflow_plan_builder.py::test_derived_metric_offset_to_grain
tests_metricflow/dataflow/optimizer/source_scan/test_cm_branch_combiner.py::test_filter_combination
tests_metricflow/integration/test_configured_cases.py::test_case[name=itest_constraints.yaml/test_constraint_with_joined_dimension_allowing_nulls]
tests_metricflow/integration/query_output/test_cumulative_metrics.py::test_cumulative_metric_with_non_adjustable_filter
tests_metricflow/dataflow/builder/test_dataflow_plan_builder.py::test_metric_in_metric_where_filter
tests_metricflow/dataflow/optimizer/test_predicate_pushdown_optimizer.py::test_fill_nulls_time_spine_metric_with_post_agg_join_predicate_pushdown ^C
Aborted!

Environment

- OS: OS X 14.4.1
- Python: 3.12.4
- dbt: -
- metricflow: latest main (b9195a6f1567f8ad90bd88a3c1582c0ff5e3b176)

Which database are you using?

bigquery

Additional Context

No response

wouter commented 2 months ago

It turned out it was an issue on my end that caused MF_SQL_ENGINE_PASSWORD to be malformed. Closing the issue.