Skip to content

Commit 58b6b80

Browse files
authored
Source Chargebee - Implement integration testing for otherwise untested streams [ITAS] (#35509)
1 parent d00a839 commit 58b6b80

38 files changed

+2618
-54
lines changed

airbyte-integrations/connectors/source-chargebee/acceptance-test-config.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ acceptance_tests:
2323
timeout_seconds: 1200
2424
empty_streams:
2525
- name: "addon"
26-
bypass_reason: "Not available for Product Catalog 2.0 sites."
26+
bypass_reason: "Not available for Product Catalog 2.0 sites. Tested with mocker server tests."
2727
- name: "plan"
28-
bypass_reason: "Not available for Product Catalog 2.0 sites."
28+
bypass_reason: "Not available for Product Catalog 2.0 sites. Tested with mocker server tests."
2929
- name: "virtual_bank_account"
30-
bypass_reason: "Cannot populate with test data"
30+
bypass_reason: "Tested with mocker server tests."
3131
- name: "event"
32-
bypass_reason: "Unstable data. Test data is not persistent."
32+
bypass_reason: "Unstable data. Test data is not persistent. Tested with mocker server tests."
3333
- name: "site_migration_detail"
34-
bypass_reason: "Cannot populate with test data."
34+
bypass_reason: "Cannnot populate with test data."
3535
- name: "customer"
36-
bypass_reason: "To be tested with integration tests."
36+
bypass_reason: "Tested with mocker server tests."
3737
- name: "subscription"
38-
bypass_reason: "To be tested with integration tests."
38+
bypass_reason: "Tested with mocker server tests."
3939
- name: "coupon"
40-
bypass_reason: "To be tested with integration tests."
40+
bypass_reason: "Tested with mocker server tests."
4141
- name: "hosted_page"
42-
bypass_reason: "To be tested with integration tests."
42+
bypass_reason: "Tested with mocker server tests."
4343
expect_records:
4444
path: "integration_tests/expected_records.jsonl"
4545
exact_order: no

airbyte-integrations/connectors/source-chargebee/integration_tests/configured_catalog.json

+15-2
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@
121121
"supported_sync_modes": ["full_refresh", "incremental"],
122122
"source_defined_cursor": true,
123123
"source_defined_primary_key": [["id"]],
124-
"default_cursor_field": ["created_at"]
124+
"default_cursor_field": ["updated_at"]
125125
},
126126
"sync_mode": "incremental",
127127
"destination_sync_mode": "append",
128-
"cursor_field": ["created_at"]
128+
"cursor_field": ["updated_at"]
129129
},
130130
{
131131
"stream": {
@@ -227,6 +227,19 @@
227227
"sync_mode": "incremental",
228228
"destination_sync_mode": "append",
229229
"cursor_field": ["updated_at"]
230+
},
231+
{
232+
"stream": {
233+
"name": "site_migration_detail",
234+
"json_schema": {},
235+
"supported_sync_modes": ["full_refresh", "incremental"],
236+
"source_defined_cursor": true,
237+
"default_cursor_field": ["migrated_at"],
238+
"source_defined_primary_key": [["entity_id"]]
239+
},
240+
"sync_mode": "incremental",
241+
"destination_sync_mode": "append",
242+
"cursor_field": ["migrated_at"]
230243
}
231244
]
232245
}

airbyte-integrations/connectors/source-chargebee/integration_tests/expected_records.jsonl

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
{"stream": "item", "data": {"id": "cbdemo_advanced", "name": "Advanced", "external_name": "Advanced", "description": "Uncover hidden insights and carry out deeper analytics for your enterprise with this advanced plan.", "status": "active", "resource_version": 1674035640445, "updated_at": 1674035640, "item_family_id": "cbdemo_pf_analytics", "type": "plan", "is_shippable": true, "is_giftable": false, "enabled_for_checkout": true, "enabled_in_portal": true, "item_applicability": "all", "metered": false, "channel": "web", "metadata": {}, "object": "item", "custom_fields": []}, "emitted_at": 1678971136879}
88
{"stream": "item", "data": {"id": "cbdemo_basic", "name": "Basic", "external_name": "Basic", "description": "Starter plan for all your basic reporting requirements.", "status": "active", "resource_version": 1674035673162, "updated_at": 1674035673, "item_family_id": "cbdemo_pf_analytics", "type": "plan", "is_shippable": true, "is_giftable": false, "enabled_for_checkout": true, "enabled_in_portal": true, "item_applicability": "all", "metered": false, "channel": "web", "metadata": {}, "object": "item", "custom_fields": []}, "emitted_at": 1678971136891}
99
{"stream": "item", "data": {"id": "cbdemo_intermediary", "name": "Intermediary", "external_name": "Intermediary", "description": "Smart plan with the right mix of basic and slightly advanced reporting tools.", "status": "active", "resource_version": 1674035686971, "updated_at": 1674035686, "item_family_id": "cbdemo_pf_analytics", "type": "plan", "is_shippable": true, "is_giftable": false, "enabled_for_checkout": true, "enabled_in_portal": true, "item_applicability": "all", "metered": false, "channel": "web", "metadata": {}, "object": "item", "custom_fields": []}, "emitted_at": 1678971136900}
10-
{"stream": "attached_item", "data": {"id": "e49c6ed7-9f1b-4c79-9235-549ce8ae9a1f", "parent_item_id": "cbdemo_advanced", "item_id": "cbdemo_setup_charge", "status": "active", "charge_on_event": "subscription_trial_start", "charge_once": false, "created_at": 1674032839, "resource_version": 1674032839573, "updated_at": 1674032839, "object": "attached_item", "custom_fields": []}, "emitted_at": 1676569205846}
11-
{"stream": "attached_item", "data": {"id": "25976ccf-8e44-4fce-8eab-2a1658eb0a2b", "parent_item_id": "cbdemo_advanced", "item_id": "cbdemo_analytics_additionalusers", "type": "mandatory", "status": "active", "quantity": 1, "created_at": 1674032827, "resource_version": 1674032827801, "updated_at": 1674032827, "object": "attached_item", "custom_fields": []}, "emitted_at": 1676569205849}
12-
{"stream": "attached_item", "data": {"id": "69b451b1-e00a-4522-ab6f-027586d24b85", "parent_item_id": "cbdemo_basic", "item_id": "cbdemo_setup_charge", "status": "active", "charge_on_event": "subscription_creation", "charge_once": false, "created_at": 1674032880, "resource_version": 1674032880261, "updated_at": 1674032880, "object": "attached_item", "custom_fields": []}, "emitted_at": 1676569206020}
13-
{"stream": "item_price", "data": {"id": "Test-Plan-1-USD-Daily", "name": "Test Plan 1 USD Daily", "item_family_id": "cbdemo_pf_analytics", "item_id": "Test-Plan-1", "description": "Test", "status": "active", "external_name": "Test Plan 1", "pricing_model": "flat_fee", "price": 1000, "period": 1, "currency_code": "USD", "period_unit": "day", "shipping_period": 1, "shipping_period_unit": "day", "free_quantity": 0, "channel": "web", "resource_version": 1674036400224, "updated_at": 1674036400, "created_at": 1674036400, "invoice_notes": "Test", "is_taxable": true, "item_type": "plan", "show_description_in_invoices": true, "show_description_in_quotes": true, "object": "item_price", "custom_fields": []}, "emitted_at": 1678971392306}
1410
{"stream": "item_price", "data": {"id": "Test-Gift-Plan-1-USD-Daily", "name": "Test Gift Plan 1 USD Daily", "item_family_id": "cbdemo_pf_crm", "item_id": "Test-Gift-Plan-1", "description": "Test gift", "status": "active", "external_name": "Test Gift Plan 1", "pricing_model": "flat_fee", "price": 1500, "period": 1, "currency_code": "USD", "period_unit": "day", "shipping_period": 1, "shipping_period_unit": "day", "billing_cycles": 1, "free_quantity": 0, "channel": "web", "resource_version": 1674055340456, "updated_at": 1674055340, "created_at": 1674055340, "invoice_notes": "Test gift", "is_taxable": true, "item_type": "plan", "show_description_in_invoices": true, "show_description_in_quotes": true, "object": "item_price", "custom_fields": []}, "emitted_at": 1678971392312}
1511
{"stream": "item_price", "data": {"id": "Test-Gift-Plan-1-USD-Weekly", "name": "Test Gift Plan 1 USD Weekly", "item_family_id": "cbdemo_pf_crm", "item_id": "Test-Gift-Plan-1", "description": "Test", "status": "active", "external_name": "Test Gift Plan 1", "pricing_model": "flat_fee", "price": 20000, "period": 1, "currency_code": "USD", "period_unit": "week", "shipping_period": 1, "shipping_period_unit": "week", "billing_cycles": 1, "free_quantity": 0, "channel": "web", "resource_version": 1674056134136, "updated_at": 1674056134, "created_at": 1674056134, "is_taxable": true, "item_type": "plan", "show_description_in_invoices": true, "show_description_in_quotes": true, "object": "item_price", "custom_fields": []}, "emitted_at": 1678971392319}
1612
{"stream": "payment_source", "data": {"id": "pm_Azz5jBTTJ96QflvC", "updated_at": 1674057604, "resource_version": 1674057604123, "deleted": false, "object": "payment_source", "customer_id": "Azz5jBTTJ96Mjlv5", "type": "card", "reference_id": "tok_Azz5jBTTJ96QSlvA", "status": "valid", "gateway": "chargebee", "gateway_account_id": "gw_16CKmRSb2oGddH4", "ip_address": "85.209.47.207", "created_at": 1674057604, "card": {"iin": "411111", "last4": "1111", "funding_type": "credit", "expiry_month": 12, "expiry_year": 2029, "masked_number": "************1111", "object": "card", "brand": "visa"}, "custom_fields": []}, "emitted_at": 1678971627515}
@@ -45,4 +41,7 @@
4541
{"stream": "item_family", "data": {"id": "test-4", "name": "test item family 4", "status": "active", "resource_version": 1705960880668, "updated_at": 1705960880, "object": "item_family", "custom_fields": []}, "emitted_at": 1705960929497}
4642
{"stream": "item_family", "data": {"id": "test-3", "name": "test item family 3", "status": "active", "resource_version": 1705956309899, "updated_at": 1705956309, "object": "item_family", "custom_fields": []}, "emitted_at": 1705960929501}
4743
{"stream": "item_family", "data": {"id": "test-2", "name": "test item family 2", "status": "active", "resource_version": 1705956286577, "updated_at": 1705956286, "object": "item_family", "custom_fields": []}, "emitted_at": 1705960929506}
48-
{"stream": "item_family", "data": {"id": "test-1", "name": "test item family 1", "status": "active", "resource_version": 1705956260965, "updated_at": 1705956260, "object": "item_family", "custom_fields": []}, "emitted_at": 1705960929509}
44+
{"stream": "item_family", "data": {"id": "test-1", "name": "test item family 1", "status": "active", "resource_version": 1705956260965, "updated_at": 1705956260, "object": "item_family", "custom_fields": []}, "emitted_at": 1705960929509}
45+
{"stream": "attached_item", "data": {"id": "25976ccf-8e44-4fce-8eab-2a1658eb0a2b", "parent_item_id": "cbdemo_advanced", "item_id": "cbdemo_analytics_additionalusers", "type": "mandatory", "status": "active", "quantity": 1, "created_at": 1674032827, "resource_version": 1674032827801, "updated_at": 1674032827, "object": "attached_item", "custom_fields": []}, "emitted_at": 1708468907178}
46+
{"stream": "attached_item", "data": {"id": "e49c6ed7-9f1b-4c79-9235-549ce8ae9a1f", "parent_item_id": "cbdemo_advanced", "item_id": "cbdemo_setup_charge", "status": "active", "charge_on_event": "subscription_trial_start", "charge_once": false, "created_at": 1674032839, "resource_version": 1674032839573, "updated_at": 1674032839, "object": "attached_item", "custom_fields": []}, "emitted_at": 1708468907177}
47+
{"stream": "attached_item", "data": {"id": "69b451b1-e00a-4522-ab6f-027586d24b85", "parent_item_id": "cbdemo_basic", "item_id": "cbdemo_setup_charge", "status": "active", "charge_on_event": "subscription_creation", "charge_once": false, "created_at": 1674032880, "resource_version": 1674032880261, "updated_at": 1674032880, "object": "attached_item", "custom_fields": []}, "emitted_at": 1708468907297}

airbyte-integrations/connectors/source-chargebee/integration_tests/future_state.json

+21
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
"stream_descriptor": { "name": "item" }
4949
}
5050
},
51+
{
52+
"type": "STREAM",
53+
"stream": {
54+
"stream_state": { "updated_at": 2147483647 },
55+
"stream_descriptor": { "name": "attached_item" }
56+
}
57+
},
5158
{
5259
"type": "STREAM",
5360
"stream": {
@@ -124,5 +131,19 @@
124131
"stream_state": { "updated_at": 2147483647 },
125132
"stream_descriptor": { "name": "differential_price" }
126133
}
134+
},
135+
{
136+
"type": "STREAM",
137+
"stream": {
138+
"stream_state": { "migrated_at": 2147483647 },
139+
"stream_descriptor": { "name": "site_migration_detail" }
140+
}
141+
},
142+
{
143+
"type": "STREAM",
144+
"stream": {
145+
"stream_state": { "occurred_at": 2147483647 },
146+
"stream_descriptor": { "name": "event" }
147+
}
127148
}
128149
]

airbyte-integrations/connectors/source-chargebee/integration_tests/sample_state.json

+7
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
"stream_descriptor": { "name": "item" }
4949
}
5050
},
51+
{
52+
"type": "STREAM",
53+
"stream": {
54+
"stream_state": { "updated_at": 1625596058 },
55+
"stream_descriptor": { "name": "attached_item" }
56+
}
57+
},
5158
{
5259
"type": "STREAM",
5360
"stream": {

airbyte-integrations/connectors/source-chargebee/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data:
1010
connectorSubtype: api
1111
connectorType: source
1212
definitionId: 686473f1-76d9-4994-9cc7-9b13da46147c
13-
dockerImageTag: 0.4.0
13+
dockerImageTag: 0.4.1
1414
dockerRepository: airbyte/source-chargebee
1515
documentationUrl: https://docs.airbyte.com/integrations/sources/chargebee
1616
githubIssueLabel: source-chargebee

0 commit comments

Comments
 (0)