Skip to content

Commit

Permalink
split final gap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
forgxyz committed Dec 18, 2024
1 parent 1e729f3 commit d4738b0
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 113 deletions.
107 changes: 0 additions & 107 deletions tests/gaps/downstream/tests__final_gaps.sql

This file was deleted.

6 changes: 0 additions & 6 deletions tests/gaps/downstream/tests__final_gaps.yml

This file was deleted.

52 changes: 52 additions & 0 deletions tests/gaps/downstream/tests__final_gaps_rec.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{ config(
severity = "error",
tags = ['gap_test']
) }}


WITH r_receipts AS (
SELECT
DISTINCT receipt_id,
block_id,
predecessor_id AS signer_id
FROM
{{ ref('silver__streamline_receipts') }}

{% if var('DBT_FULL_TEST') %}
WHERE
_inserted_timestamp < SYSDATE() - INTERVAL '1 hour'
{% else %}
WHERE
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days'
AND SYSDATE() - INTERVAL '1 hour'
{% endif %}
),
f_receipts AS (
SELECT
DISTINCT receipt_object_id AS receipt_id,
block_id,
receipt_actions :predecessor_id :: STRING AS signer_id
FROM
{{ ref('silver__streamline_receipts_final') }}

{% if var('DBT_FULL_TEST') %}
WHERE
_inserted_timestamp < SYSDATE() - INTERVAL '1 hour'
{% else %}
WHERE
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days'
AND SYSDATE() - INTERVAL '1 hour'
{% endif %}
)
SELECT
r_receipts.receipt_id AS receipt_id,
r_receipts.block_id,
r_receipts.signer_id
FROM
r_receipts
LEFT JOIN
f_receipts
ON
r_receipts.receipt_id = f_receipts.receipt_id
WHERE
f_receipts.receipt_id IS NULL
53 changes: 53 additions & 0 deletions tests/gaps/downstream/tests__final_gaps_tx.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{ config(
severity = "error",
tags = ['gap_test']
) }}


WITH
r_transactions AS (
SELECT
DISTINCT tx_hash,
block_id,
_signer_id AS signer_id
FROM
{{ ref('silver__streamline_transactions') }}

{% if var('DBT_FULL_TEST') %}
WHERE
_inserted_timestamp < SYSDATE() - INTERVAL '1 hour'
{% else %}
WHERE
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days'
AND SYSDATE() - INTERVAL '1 hour'
{% endif %}
),
f_transactions AS (
SELECT
DISTINCT tx_hash,
block_id,
tx_signer AS signer_id
FROM
{{ ref('silver__streamline_transactions_final') }}

{% if var('DBT_FULL_TEST') %}
WHERE
_inserted_timestamp < SYSDATE() - INTERVAL '1 hour'
{% else %}
WHERE
_inserted_timestamp BETWEEN SYSDATE() - INTERVAL '7 days'
AND SYSDATE() - INTERVAL '1 hour'
{% endif %}
)
SELECT
r_transactions.tx_hash AS tx_hash,
r_transactions.block_id,
r_transactions.signer_id
FROM
r_transactions
LEFT JOIN
f_transactions
ON
r_transactions.tx_hash = f_transactions.tx_hash
WHERE
f_transactions.tx_hash IS NULL

0 comments on commit d4738b0

Please sign in to comment.