Skip to content

Commit

Permalink
Merge branch 'fix/xts-bridge-failures' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Higgs committed Jun 11, 2021
2 parents 859aac9 + e21a9d1 commit fe6bcb0
Show file tree
Hide file tree
Showing 8 changed files with 1,179 additions and 563 deletions.
180 changes: 180 additions & 0 deletions test_project/features/bridge/bridge_one_hub_one_link.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
@fixture.set_workdir
Feature: Bridge table - Base Bridge behaviour with one hub and one/two/three links

@fixture.bridge
Scenario: [BASE-LOAD] Base load into a bridge table from one hub and one link with the AS_OF date and LDTS equal
Given the BRIDGE_CUSTOMER_ORDER table does not exist
And the raw vault contains empty tables
| HUB | LINK | EFF_SAT | BRIDGE |
| HUB_CUSTOMER | LINK_CUSTOMER_ORDER | EFF_SAT_CUSTOMER_ORDER | BRIDGE_CUSTOMER_ORDER |
And the RAW_CUSTOMER_ORDER table contains data
| CUSTOMER_ID | ORDER_ID | LOAD_DATETIME | END_DATE | SOURCE |
| 1001 | 100 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1002 | 200 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1003 | 300 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1004 | 400 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
And I create the STG_CUSTOMER_ORDER stage
And the AS_OF_DATE table is created and populated with data
| AS_OF_DATE |
| 2018-06-01 00:00:00.000 |
When I load the vault
Then the HUB_CUSTOMER table should contain expected data
| CUSTOMER_PK | CUSTOMER_ID | LOAD_DATETIME | SOURCE |
| md5('1001') | 1001 | 2018-06-01 00:00:00.000 | * |
| md5('1002') | 1002 | 2018-06-01 00:00:00.000 | * |
| md5('1003') | 1003 | 2018-06-01 00:00:00.000 | * |
| md5('1004') | 1004 | 2018-06-01 00:00:00.000 | * |
Then the LINK_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 00:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-01 00:00:00.000 | * |
| md5('1004\|\|400') | md5('1004') | md5('400') | 2018-06-01 00:00:00.000 | * |
Then the EFF_SAT_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | START_DATE | END_DATE | EFFECTIVE_FROM | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1004\|\|400') | md5('1004') | md5('400') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
Then the BRIDGE_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_PK | AS_OF_DATE | LINK_CUSTOMER_ORDER_PK |
| md5('1001') | 2018-06-01 00:00:00.000 | md5('1001\|\|100') |
| md5('1002') | 2018-06-01 00:00:00.000 | md5('1002\|\|200') |
| md5('1003') | 2018-06-01 00:00:00.000 | md5('1003\|\|300') |
| md5('1004') | 2018-06-01 00:00:00.000 | md5('1004\|\|400') |

@fixture.bridge
Scenario: [BASE-LOAD] Base load into a bridge table from one hub and one link with AS_OF dates in the past
Given the BRIDGE_CUSTOMER_ORDER table does not exist
And the raw vault contains empty tables
| HUB | LINK | EFF_SAT | BRIDGE |
| HUB_CUSTOMER | LINK_CUSTOMER_ORDER | EFF_SAT_CUSTOMER_ORDER | BRIDGE_CUSTOMER_ORDER |
And the RAW_CUSTOMER_ORDER table contains data
| CUSTOMER_ID | ORDER_ID | LOAD_DATETIME | END_DATE | SOURCE |
| 1001 | 100 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1002 | 200 | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1003 | 300 | 2018-06-02 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1004 | 400 | 2018-06-02 12:00:00.000 | 9999-12-31 23:59:59.999 | * |
And I create the STG_CUSTOMER_ORDER stage
And the AS_OF_DATE table is created and populated with data
| AS_OF_DATE |
| 2018-05-30 00:00:00.000 |
| 2018-05-31 00:00:00.000 |
When I load the vault
Then the HUB_CUSTOMER table should contain expected data
| CUSTOMER_PK | CUSTOMER_ID | LOAD_DATETIME | SOURCE |
| md5('1001') | 1001 | 2018-06-01 00:00:00.000 | * |
| md5('1002') | 1002 | 2018-06-01 12:00:00.000 | * |
| md5('1003') | 1003 | 2018-06-02 00:00:00.000 | * |
| md5('1004') | 1004 | 2018-06-02 12:00:00.000 | * |
Then the LINK_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 12:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-02 00:00:00.000 | * |
| md5('1004\|\|400') | md5('1004') | md5('400') | 2018-06-02 12:00:00.000 | * |
Then the EFF_SAT_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | START_DATE | END_DATE | EFFECTIVE_FROM | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 12:00:00.000 | 2018-06-01 12:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-02 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-02 00:00:00.000 | 2018-06-02 00:00:00.000 | * |
| md5('1004\|\|400') | md5('1004') | md5('400') | 2018-06-02 12:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-02 12:00:00.000 | 2018-06-02 12:00:00.000 | * |
Then the BRIDGE_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_PK | AS_OF_DATE | LINK_CUSTOMER_ORDER_PK |

@fixture.bridge
Scenario: [BASE-LOAD] Base load into a bridge table from one hub and one link with AS_OF dates in the future
Given the BRIDGE_CUSTOMER_ORDER table does not exist
And the raw vault contains empty tables
| HUB | LINK | EFF_SAT | BRIDGE |
| HUB_CUSTOMER | LINK_CUSTOMER_ORDER | EFF_SAT_CUSTOMER_ORDER | BRIDGE_CUSTOMER_ORDER |
And the RAW_CUSTOMER_ORDER table contains data
| CUSTOMER_ID | ORDER_ID | LOAD_DATETIME | END_DATE | SOURCE |
| 1001 | 100 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1002 | 200 | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1003 | 300 | 2018-06-02 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1004 | 400 | 2018-06-02 12:00:00.000 | 9999-12-31 23:59:59.999 | * |
And I create the STG_CUSTOMER_ORDER stage
And the AS_OF_DATE table is created and populated with data
| AS_OF_DATE |
| 2018-06-03 00:00:00.000 |
| 2018-06-04 00:00:00.000 |
When I load the vault
Then the HUB_CUSTOMER table should contain expected data
| CUSTOMER_PK | CUSTOMER_ID | LOAD_DATETIME | SOURCE |
| md5('1001') | 1001 | 2018-06-01 00:00:00.000 | * |
| md5('1002') | 1002 | 2018-06-01 12:00:00.000 | * |
| md5('1003') | 1003 | 2018-06-02 00:00:00.000 | * |
| md5('1004') | 1004 | 2018-06-02 12:00:00.000 | * |
Then the LINK_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 12:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-02 00:00:00.000 | * |
| md5('1004\|\|400') | md5('1004') | md5('400') | 2018-06-02 12:00:00.000 | * |
Then the EFF_SAT_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | START_DATE | END_DATE | EFFECTIVE_FROM | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 12:00:00.000 | 2018-06-01 12:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-02 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-02 00:00:00.000 | 2018-06-02 00:00:00.000 | * |
| md5('1004\|\|400') | md5('1004') | md5('400') | 2018-06-02 12:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-02 12:00:00.000 | 2018-06-02 12:00:00.000 | * |
Then the BRIDGE_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_PK | AS_OF_DATE | LINK_CUSTOMER_ORDER_PK |
| md5('1001') | 2018-06-03 00:00:00.000 | md5('1001\|\|100') |
| md5('1002') | 2018-06-03 00:00:00.000 | md5('1002\|\|200') |
| md5('1003') | 2018-06-03 00:00:00.000 | md5('1003\|\|300') |
| md5('1004') | 2018-06-03 00:00:00.000 | md5('1004\|\|400') |
| md5('1001') | 2018-06-04 00:00:00.000 | md5('1001\|\|100') |
| md5('1002') | 2018-06-04 00:00:00.000 | md5('1002\|\|200') |
| md5('1003') | 2018-06-04 00:00:00.000 | md5('1003\|\|300') |
| md5('1004') | 2018-06-04 00:00:00.000 | md5('1004\|\|400') |

@fixture.bridge
Scenario: [BASE-LOAD] Base load into a bridge table from one hub and one link with multiple loads and an encompassing range of AS OF dates
Given the BRIDGE_CUSTOMER_ORDER table does not exist
And the raw vault contains empty tables
| HUB | LINK | EFF_SAT | BRIDGE |
| HUB_CUSTOMER | LINK_CUSTOMER_ORDER | EFF_SAT_CUSTOMER_ORDER | BRIDGE_CUSTOMER_ORDER |
And the RAW_CUSTOMER_ORDER table contains data
| CUSTOMER_ID | ORDER_ID | LOAD_DATETIME | END_DATE | SOURCE |
| 1001 | 100 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1002 | 200 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1002 | 201 | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1003 | 300 | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | * |
| 1003 | 301 | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | * |
And I create the STG_CUSTOMER_ORDER stage
And the AS_OF_DATE table is created and populated with data
| AS_OF_DATE |
| 2018-05-31 00:00:00.000 |
| 2018-06-01 00:00:00.000 |
| 2018-06-02 00:00:00.000 |
When I load the vault
Then the HUB_CUSTOMER table should contain expected data
| CUSTOMER_PK | CUSTOMER_ID | LOAD_DATETIME | SOURCE |
| md5('1001') | 1001 | 2018-06-01 00:00:00.000 | * |
| md5('1002') | 1002 | 2018-06-01 00:00:00.000 | * |
| md5('1003') | 1003 | 2018-06-01 00:00:00.000 | * |
Then the LINK_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|201') | md5('1002') | md5('201') | 2018-06-01 12:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-01 00:00:00.000 | * |
| md5('1003\|\|301') | md5('1003') | md5('301') | 2018-06-01 12:00:00.000 | * |
Then the EFF_SAT_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_ORDER_PK | CUSTOMER_FK | ORDER_FK | START_DATE | END_DATE | EFFECTIVE_FROM | LOAD_DATETIME | SOURCE |
| md5('1001\|\|100') | md5('1001') | md5('100') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|200') | md5('1002') | md5('200') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1002\|\|201') | md5('1002') | md5('201') | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 12:00:00.000 | 2018-06-01 12:00:00.000 | * |
| md5('1003\|\|300') | md5('1003') | md5('300') | 2018-06-01 00:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 00:00:00.000 | 2018-06-01 00:00:00.000 | * |
| md5('1003\|\|301') | md5('1003') | md5('301') | 2018-06-01 12:00:00.000 | 9999-12-31 23:59:59.999 | 2018-06-01 12:00:00.000 | 2018-06-01 12:00:00.000 | * |
Then the BRIDGE_CUSTOMER_ORDER table should contain expected data
| CUSTOMER_PK | AS_OF_DATE | LINK_CUSTOMER_ORDER_PK |
| md5('1001') | 2018-06-01 00:00:00.000 | md5('1001\|\|100') |
| md5('1002') | 2018-06-01 00:00:00.000 | md5('1002\|\|200') |
| md5('1003') | 2018-06-01 00:00:00.000 | md5('1003\|\|300') |
| md5('1001') | 2018-06-02 00:00:00.000 | md5('1001\|\|100') |
| md5('1002') | 2018-06-02 00:00:00.000 | md5('1002\|\|200') |
| md5('1002') | 2018-06-02 00:00:00.000 | md5('1002\|\|201') |
| md5('1003') | 2018-06-02 00:00:00.000 | md5('1003\|\|300') |
| md5('1003') | 2018-06-02 00:00:00.000 | md5('1003\|\|301') |
Loading

0 comments on commit fe6bcb0

Please sign in to comment.