You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "airajena (via GitHub)" <gi...@apache.org> on 2026/07/27 15:02:45 UTC
[I] Add test suite: extractor unit tests, dbt singular SQL tests, and Superset bootstrap tests [fineract-business-intelligence]
airajena opened a new issue, #45:
URL: https://github.com/apache/fineract-business-intelligence/issues/45
## Overview
Zero pytest, zero dbt singular tests currently. 18 CI smoke tests exist but only cover
happy-path E2E. Need module-level tests that catch logic bugs before E2E.
## Scope
### Extractor (pytest + pytest-mock)
File: `tests/extractor/`
- `test_cob_gate.py` — COB gate raises when no completed job, raises when too old, passes when recent
- `test_watermark_manager.py` — get() returns None on miss, update() upserts correct params, tenant isolation
- `test_build_source_query.py` — no WHERE clause on backfill, WHERE cursor >= %s on incremental
- `test_extract_table.py` — lookback subtracted from watermark, backfill uses None watermark
- `test_upsert_rows.py` — placeholder count matches column count, ON CONFLICT clause present
- `test_utils.py` — as_utc_datetime() attaches UTC to naive datetime, _quote_identifier() escapes double quotes
### dbt Singular SQL Tests
File: `dbt/tests/`
Each returns 0 rows = pass:
- `assert_par_hierarchy_never_violated.sql` — par_30 >= par_60 >= par_90
- `assert_repayment_components_dont_exceed_total.sql` — principal+interest+fee+penalty+overpayment <= actual_collected * 1.001
- `assert_collection_efficiency_ratio_in_bounds.sql` — ratio between 0 and 10
- `assert_borrower_count_lte_transaction_count.sql` — repaying_borrower_count <= repayment_transaction_count
- `assert_waived_never_exceeds_charged.sql` — overdue_penalty_waived <= overdue_penalty_charged
- `assert_principal_outstanding_never_negative.sql` — principal_outstanding_derived >= 0
- `assert_recovery_loan_count_never_negative.sql` — recovery_loan_count >= 0
### dbt Schema Tests (dbt-utils)
Add `dbt-utils` to `dbt/packages.yml`. Add `expression_is_true` to `_marts.yml`:
- `par_30_amount >= par_60_amount`
- `collection_efficiency_ratio >= 0`
- `repaying_borrower_count <= repayment_transaction_count`
### Superset Bootstrap (pytest + pytest-mock)
File: `tests/superset/`
- `test_ensure_chart_idempotency.py` — ensure_chart() called twice creates only 1 chart
- `test_kpi_formats.py` — Collection Efficiency number_format = ",.2f", metric multiplied by 100
- `test_mart_exists_engine.py` — mart_exists() queries warehouse engine not superset_metadata (regression)
- `test_rls_filter.py` — RLS filter contains office_id check and ADMIN bypass
## New Dependencies
| Package | Where |
|---|---|
| `pytest` | `extractor/requirements.txt` |
| `pytest-mock` | `extractor/requirements.txt` |
| `dbt-utils` | `dbt/packages.yml` |
## Acceptance Criteria
- [ ] `pytest tests/` passes with no DB connection required
- [ ] `dbt test` runs all singular SQL tests in CI
- [ ] All new tests added to CI `ci.yml` compilation-checks or integration-test job
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add test suite: extractor unit tests, dbt singular SQL tests, and Superset bootstrap tests [fineract-business-intelligence]
Posted by "Aman-Mittal (via GitHub)" <gi...@apache.org>.
Aman-Mittal closed issue #45: Add test suite: extractor unit tests, dbt singular SQL tests, and Superset bootstrap tests
URL: https://github.com/apache/fineract-business-intelligence/issues/45
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org