Skip to content

Add profiler correctness tests for Redshift and Synapse - #2569

Open
nnigam19 wants to merge 1 commit into
mainfrom
profiler-correctness-integration-tests
Open

Add profiler correctness tests for Redshift and Synapse#2569
nnigam19 wants to merge 1 commit into
mainfrom
profiler-correctness-integration-tests

Conversation

@nnigam19

Copy link
Copy Markdown

What

Adds the first profiler-correctness tests, following review feedback that the
suite should validate profiler correctness, not just that the pipeline engine
runs. Test-only, no production changes.

  • test_profiler_correctness_redshift.py (integration) - runs the real
    Redshift provisioned profiler queries against the live Redshift sandbox and
    asserts the DuckDB extract has no stray tables, the always-produced tables are
    present, and each produced table has exactly the expected column set. Skips
    when REDSHIFT_* creds are absent (runs in CI).
  • test_profiler_correctness_synapse.py (integration) - runs the real
    Synapse metadata extract queries (INFORMATION_SCHEMA: tables/columns/views/
    routines) against the SQL Server sandbox stand-in and asserts each result
    ingests into its pinned SYNAPSE_SCHEMAS shape. Skips when TEST_TSQL_* creds
    are absent (runs in CI).
  • test_synapse_schema_contract.py - validates every SYNAPSE_SCHEMAS
    declaration is valid DuckDB DDL producing exactly the declared columns and
    types. Needs no creds.
  • profiler_extract_helpers.py - shared, non-test helpers (schema parsing,
    DuckDB inspection, env gating) used by the above.

Testing

  • test_synapse_schema_contract.py: 41 cases, all passing locally.
  • The two integration tests were verified to lint clean and skip gracefully
    without creds, they exercise their live sandboxes in CI, where their exact
    column/schema expectations get their first live validation.

Known gaps (follow-ups)

  • Synapse coverage is the metadata subset only, the Azure-API steps (workspace
    info, monitoring metrics, SQL-pool enumeration) and SYS.DM_PDW_* activity
    extracts require a real Synapse workspace and are not covered.
  • No Oracle integration test yet - blocked on provisioning an Oracle sandbox and
    credentials.
  • Tests assert schema/column correctness, not value-level correctness.

@nnigam19
nnigam19 requested a review from a team as a code owner July 14, 2026 17:57
@nnigam19
nnigam19 requested review from dgomez04 and m-abulazm July 14, 2026 17:58
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.50%. Comparing base (7f61051) to head (6613dbc).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2569   +/-   ##
=======================================
  Coverage   69.50%   69.50%           
=======================================
  Files         107      107           
  Lines        9626     9626           
  Branches     1065     1065           
=======================================
  Hits         6691     6691           
  Misses       2734     2734           
  Partials      201      201           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown

❌ 219/220 passed, 45 flaky, 1 failed, 2 skipped, 15m20s total

❌ test_redshift_provisioned_profiler_extract_is_correct: AssertionError: Column mismatch for table 'rs_avg_queries_minute' (6.914s)
AssertionError: Column mismatch for table 'rs_avg_queries_minute'
assert {'0', '1'} == {'avg_queries...', 'set_name'}
  
  Extra items in the left set:
  '0'
  '1'
  Extra items in the right set:
  'avg_queries_minute'
  'set_name'
  
  Full diff:
    {
  -     'avg_queries_minute',
  -     'set_name',
  +     '0',
  +     '1',
    }
[gw0] linux -- Python 3.10.20 /home/runner/work/lakebridge/lakebridge/.venv/bin/python
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: drop_query_view
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step drop_query_view has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: query_view
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step query_view has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_spectrum_tb_month
17:59 WARNING [root] Query for step 'rs_spectrum_tb_month' returned 0 rows. Skipping table creation and data insertion.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_spectrum_tb_month has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_managed_storage_gb
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_managed_storage_gb has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_nodes
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_nodes has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_avg_concurrent_users
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_avg_concurrent_users has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_avg_queries_minute
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_avg_queries_minute has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_query_type_by_hour
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_query_type_by_hour has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_cpu_consumption_by_query_type
17:59 WARNING [root] Query for step 'chart_cpu_consumption_by_query_type' returned 0 rows. Skipping table creation and data insertion.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_cpu_consumption_by_query_type has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_concurrent_users_by_hour
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_concurrent_users_by_hour has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_cpu_consumption_by_hour_and_query_type
17:59 WARNING [root] Query for step 'chart_cpu_consumption_by_hour_and_query_type' returned 0 rows. Skipping table creation and data insertion.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_cpu_consumption_by_hour_and_query_type has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: drop_query_view
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step drop_query_view has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: query_view
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step query_view has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_spectrum_tb_month
17:59 WARNING [root] Query for step 'rs_spectrum_tb_month' returned 0 rows. Skipping table creation and data insertion.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_spectrum_tb_month has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_managed_storage_gb
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_managed_storage_gb has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_nodes
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_nodes has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_avg_concurrent_users
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_avg_concurrent_users has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: rs_avg_queries_minute
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step rs_avg_queries_minute has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_query_type_by_hour
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_query_type_by_hour has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_cpu_consumption_by_query_type
17:59 WARNING [root] Query for step 'chart_cpu_consumption_by_query_type' returned 0 rows. Skipping table creation and data insertion.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_cpu_consumption_by_query_type has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_concurrent_users_by_hour
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_concurrent_users_by_hour has completed successfully.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Executing step: chart_cpu_consumption_by_hour_and_query_type
17:59 WARNING [root] Query for step 'chart_cpu_consumption_by_hour_and_query_type' returned 0 rows. Skipping table creation and data insertion.
17:59 INFO [databricks.labs.lakebridge.assessments.pipeline] Step chart_cpu_consumption_by_hour_and_query_type has completed successfully.
[gw0] linux -- Python 3.10.20 /home/runner/work/lakebridge/lakebridge/.venv/bin/python

Flaky tests:

  • 🤪 test_capture_mismatch_data_and_cols_fail (176ms)
  • 🤪 test_compare_data_special_column_names (269ms)
  • 🤪 test_compare_data_for_report_hash (252ms)
  • 🤪 test_capture_mismatch_data_and_cols_special_column_names (209ms)
  • 🤪 test_recon_capture_start_snowflake_all (275ms)
  • 🤪 test_databricks_list_schemas_happy_TEST_CATALOG (249ms)
  • 🤪 test_capture_mismatch_data_and_cols (273ms)
  • 🤪 test_test_recon_capture_start_databricks_data (219ms)
  • 🤪 test_recon_capture_start_oracle_with_exception (196ms)
  • 🤪 test_test_recon_capture_start_databricks_row (236ms)
  • 🤪 test_schema_recon_with_general_exception (323ms)
  • 🤪 test_recon_capture_start_with_exception (154ms)
  • 🤪 test_generate_final_reconcile_output_row (156ms)
  • 🤪 test_recon_capture_start_oracle_schema (221ms)
  • 🤪 test_generate_final_reconcile_output_schema (131ms)
  • 🤪 test_generate_final_reconcile_output_exception (173ms)
  • 🤪 test_generate_final_reconcile_output_data (193ms)
  • 🤪 test_generate_final_reconcile_output_all (145ms)
  • 🤪 test_apply_threshold_for_mismatch_with_missing (207ms)
  • 🤪 test_apply_threshold_for_mismatch_with_wrong_absolute_bound (135ms)
  • 🤪 test_apply_threshold_for_mismatch_with_true_absolute (154ms)
  • 🤪 test_apply_threshold_for_mismatch_with_wrong_percentage_bound (170ms)
  • 🤪 test_apply_threshold_for_mismatch_with_schema_fail (5.198s)
  • 🤪 test_apply_threshold_for_mismatch_with_true_percentage_bound (10.01s)
  • 🤪 test_apply_threshold_for_mismatch_with_invalid_bounds (10.007s)
  • 🤪 test_apply_threshold_for_only_threshold_mismatch_with_true_absolute (10.006s)
  • 🤪 test_is_databricks_false (10.007s)
  • 🤪 test_recon_databricks_job_succeeds (4.14s)
  • 🤪 test_dir_uses_tempfile (9.489s)
  • 🤪 test_run_with_invalid_operation_name (10.009s)
  • 🤪 test_recon_for_report_type_is_data (10.008s)
  • 🤪 test_reconcile_data_without_mismatches_and_missing (5.248s)
  • 🤪 test_format_uses_parquet (10.007s)
  • 🤪 test_is_serverless (10.006s)
  • 🤪 test_data_recon_with_source_exception (10.006s)
  • 🤪 test_recon_sql_server_job_succeeds (10.007s)
  • 🤪 test_recon_for_report_type_schema (5.547s)
  • 🤪 test_recon_snowflake_job_succeeds (10.007s)
  • 🤪 test_recon_teradata_job_succeeds (10.007s)
  • 🤪 test_recon_redshift_job_succeeds (5.119s)
  • 🤪 test_recon_oracle_job_succeeds (5.545s)
  • 🤪 test_stratified_sampler_count (10.008s)
  • 🤪 test_initialise_data_source (6.616s)
  • 🤪 test_auto_configure_tables_writes_table_recon_config (10.008s)
  • 🤪 test_recon_bigquery_job_succeeds (10.007s)

Running from acceptance #5059

@m-abulazm m-abulazm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer e2e tests that are more future proof. I would test the entry point Profiler instead of testing internal profiler components. at the beginning we can keep the assertions minimal. dont assert columns, it can be that it ran and terminated successfully, start with redshift and sqlserver as synapse secrets are not there yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants