Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(devex): parametrize source families in test_end_to_end.py + docs (#59405)

Julian Bez228a75c6a41b
diff --git a/.test_durations b/.test_durations
index 713590dafc7d..373504bc62d1 100644
--- a/.test_durations
+++ b/.test_durations
@@ -34533,26 +34533,26 @@
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_create_external_job_failure_no_job_model": 1.1155707149999898,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_create_external_job_failure_no_job_model[non_dlt]": 1.691320363999921,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_create_external_job_failure_no_job_model[v3]": 3.948767244999999,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_broadcasts[non_dlt]": 1.4887659380001423,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_broadcasts[v3]": 5.7101922590001095,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_campaigns[non_dlt]": 2.29093933199988,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_campaigns[v3]": 3.5896431540001004,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_collections[non_dlt]": 2.530026036000095,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_collections[v3]": 2.9246342079999295,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_newsletters[non_dlt]": 6.067417550999949,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_newsletters[v3]": 3.0910146289999147,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_object_types[non_dlt]": 3.798402729999907,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_object_types[v3]": 4.041777055999773,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_segments[non_dlt]": 2.344357870999829,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_segments[v3]": 2.312093268000126,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_sender_identities[non_dlt]": 5.781397263000031,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_sender_identities[v3]": 3.054853995999906,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_snippets[non_dlt]": 2.067873456999905,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_snippets[v3]": 1.9091229999999086,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_subscription_topics[non_dlt]": 2.8502104249998865,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_subscription_topics[v3]": 7.1722595929999216,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_transactional[non_dlt]": 2.677047178999942,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_transactional[v3]": 2.256250825999814,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-broadcasts-customerio_broadcasts-customer_io_broadcasts-broadcasts]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-campaigns-customerio_campaigns-customer_io_campaigns-campaigns]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-collections-customerio_collections-customer_io_collections-collections]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-newsletters-customerio_newsletters-customer_io_newsletters-newsletters]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-object_types-customerio_object_types-customer_io_object_types-types]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-segments-customerio_segments-customer_io_segments-segments]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-sender_identities-customerio_sender_identities-customer_io_sender_identities-sender_identities]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-snippets-customerio_snippets-customer_io_snippets-snippets]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-subscription_topics-customerio_subscription_topics-customer_io_subscription_topics-topics]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[non_dlt-transactional-customerio_transactional-customer_io_transactional-messages]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-broadcasts-customerio_broadcasts-customer_io_broadcasts-broadcasts]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-campaigns-customerio_campaigns-customer_io_campaigns-campaigns]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-collections-customerio_collections-customer_io_collections-collections]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-newsletters-customerio_newsletters-customer_io_newsletters-newsletters]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-object_types-customerio_object_types-customer_io_object_types-types]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-segments-customerio_segments-customer_io_segments-segments]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-sender_identities-customerio_sender_identities-customer_io_sender_identities-sender_identities]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-snippets-customerio_snippets-customer_io_snippets-snippets]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-subscription_topics-customerio_subscription_topics-customer_io_subscription_topics-topics]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_customer_io_source[v3-transactional-customerio_transactional-customer_io_transactional-messages]": 18.0,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_decimal_down_scales": 8.561460441000008,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_decimal_down_scales[non_dlt]": 3.408433602000059,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_decimal_down_scales[v3]": 3.1709820999999465,
@@ -34589,10 +34589,10 @@
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_non_retryable_error_with_special_characters": 1.0737199060000648,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_non_retryable_error_with_special_characters[non_dlt]": 1.6042614260001073,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_non_retryable_error_with_special_characters[v3]": 1.7054728880000312,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_customers[non_dlt]": 1.9821839460000774,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_customers[v3]": 2.141744610000046,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_subscriptions[non_dlt]": 4.264598235000051,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_subscriptions[v3]": 2.07569915199997,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_source[non_dlt-customers-paddle_customers-paddle_customers]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_source[non_dlt-subscriptions-paddle_subscriptions-paddle_subscriptions]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_source[v3-customers-paddle_customers-paddle_customers]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_paddle_source[v3-subscriptions-paddle_subscriptions-paddle_subscriptions]": 18.0,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_partition_folders_delta_merge_called_with_partition_predicate": 8.546417454999983,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_partition_folders_delta_merge_called_with_partition_predicate[non_dlt]": 3.073276839999835,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_partition_folders_delta_merge_called_with_partition_predicate[v3]": 3.922673398999791,
@@ -34663,46 +34663,36 @@
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_charges": 3.5530592719999277,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_charges[non_dlt]": 2.355696840000064,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_charges[v3]": 3.010675831999947,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_credit_note": 3.484291116999998,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_credit_note[non_dlt]": 2.329930441999977,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_credit_note[v3]": 5.163948562000201,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer": 3.7304045519999818,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer[non_dlt]": 2.3520532399999183,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer[v3]": 4.943211757000199,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer_balance_transaction": 3.788895119000017,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer_balance_transaction[non_dlt]": 2.35347476000004,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer_balance_transaction[v3]": 2.6716048690000207,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer_payment_method": 3.6408417650000047,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer_payment_method[non_dlt]": 4.534626630999924,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_customer_payment_method[v3]": 2.5881329259999575,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_dispute": 3.5426327380000657,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_dispute[non_dlt]": 2.242957926000031,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_dispute[v3]": 2.627673962000017,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_earliest_incremental_value": 4.691312218000007,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_earliest_incremental_value[non_dlt]": 2.1707725700000537,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_earliest_incremental_value[v3]": 5.162181222000072,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_earliest_incremental_value_v2": 2.276772011000162,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_invoice": 3.760603372999981,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_invoice[non_dlt]": 2.5963911510000344,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_invoice[v3]": 2.7331846519998635,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_invoiceitem": 3.670582710999952,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_invoiceitem[non_dlt]": 2.2162884220001615,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_invoiceitem[v3]": 2.5189533659998915,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_payout": 4.009920427999873,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_payout[non_dlt]": 4.908911261999833,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_payout[v3]": 2.6781684409999116,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_price": 3.7473532019998856,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_price[non_dlt]": 2.3815278120000585,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_price[v3]": 5.143242950999934,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_product": 3.5337262479999936,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_product[non_dlt]": 2.4479251940000495,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_product[v3]": 2.7840977300002123,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_refund": 3.65992574400002,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_refund[non_dlt]": 2.416182952999975,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_refund[v3]": 5.067502089999948,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_subscription": 3.8973854280001206,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_subscription[non_dlt]": 2.4942671200000177,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_subscription[v3]": 4.643809555999951,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-BalanceTransaction-stripe_balancetransaction-stripe_balance_transaction]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-CreditNote-stripe_creditnote-stripe_credit_note]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Customer-stripe_customer-stripe_customer]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-CustomerBalanceTransaction-stripe_customerbalancetransaction-stripe_customer_balance_transaction]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-CustomerPaymentMethod-stripe_customerpaymentmethod-stripe_customer_payment_method]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Dispute-stripe_dispute-stripe_dispute]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Invoice-stripe_invoice-stripe_invoice]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-InvoiceItem-stripe_invoiceitem-stripe_invoiceitem]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Payout-stripe_payout-stripe_payout]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Price-stripe_price-stripe_price]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Product-stripe_product-stripe_product]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Refund-stripe_refund-stripe_refund]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[non_dlt-Subscription-stripe_subscription-stripe_subscription]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-BalanceTransaction-stripe_balancetransaction-stripe_balance_transaction]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-CreditNote-stripe_creditnote-stripe_credit_note]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Customer-stripe_customer-stripe_customer]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-CustomerBalanceTransaction-stripe_customerbalancetransaction-stripe_customer_balance_transaction]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-CustomerPaymentMethod-stripe_customerpaymentmethod-stripe_customer_payment_method]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Dispute-stripe_dispute-stripe_dispute]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Invoice-stripe_invoice-stripe_invoice]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-InvoiceItem-stripe_invoiceitem-stripe_invoiceitem]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Payout-stripe_payout-stripe_payout]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Price-stripe_price-stripe_price]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Product-stripe_product-stripe_product]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Refund-stripe_refund-stripe_refund]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_source[v3-Subscription-stripe_subscription-stripe_subscription]": 18.0,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_webhook_consumer_e2e[non_dlt]": 4.779843546000052,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_webhook_consumer_e2e[v3]": 3.104328791999933,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_stripe_webhook_s3_charges[non_dlt]": 5.945410100000117,
@@ -34718,33 +34708,24 @@
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_worker_shutdown_triggers_schedule_buffer_one": 31.661472762999892,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_worker_shutdown_triggers_schedule_buffer_one[non_dlt]": 7.827636790000042,
"posthog/temporal/tests/data_imports/test_end_to_end.py::test_worker_shutdown_triggers_schedule_buffer_one[v3]": 8.992167855000048,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_brands": 3.0617809600000783,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_brands[non_dlt]": 2.171609418999992,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_brands[v3]": 2.6071102990000554,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_groups": 2.920337601999904,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_groups[non_dlt]": 2.337235428000099,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_groups[v3]": 2.7959135110000943,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_organizations": 2.623955950000095,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_organizations[non_dlt]": 4.708504494999943,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_organizations[v3]": 2.643353579999939,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_sla_policies": 2.794815741999969,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_sla_policies[non_dlt]": 2.6530381149999585,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_sla_policies[v3]": 4.856350264000071,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_events": 2.9550965129998303,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_events[non_dlt]": 2.4406162700001914,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_events[v3]": 2.600951046000091,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_fields": 2.6418899289999445,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_fields[non_dlt]": 2.3972424720000163,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_fields[v3]": 5.097049410000068,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_metric_events": 2.7393960690000085,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_metric_events[non_dlt]": 2.276014649999979,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_ticket_metric_events[v3]": 2.562804050000068,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_tickets": 3.0786760319999757,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_tickets[non_dlt]": 2.4220600200000035,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_tickets[v3]": 5.260633390999942,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_users": 2.848432346000095,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_users[non_dlt]": 2.5001009879999856,
- "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_users[v3]": 2.4599319270000706,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-brands-zendesk_brands-zendesk_brands-brands]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-groups-zendesk_groups-zendesk_groups-groups]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-organizations-zendesk_organizations-zendesk_organizations-organizations]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-sla_policies-zendesk_sla_policies-zendesk_sla_policies-sla_policies]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-ticket_events-zendesk_ticket_events-zendesk_ticket_events-ticket_events]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-ticket_fields-zendesk_ticket_fields-zendesk_ticket_fields-ticket_fields]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-ticket_metric_events-zendesk_ticket_metric_events-zendesk_ticket_metric_events-ticket_metric_events]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-tickets-zendesk_tickets-zendesk_tickets-tickets]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[non_dlt-users-zendesk_users-zendesk_users-users]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-brands-zendesk_brands-zendesk_brands-brands]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-groups-zendesk_groups-zendesk_groups-groups]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-organizations-zendesk_organizations-zendesk_organizations-organizations]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-sla_policies-zendesk_sla_policies-zendesk_sla_policies-sla_policies]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-ticket_events-zendesk_ticket_events-zendesk_ticket_events-ticket_events]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-ticket_fields-zendesk_ticket_fields-zendesk_ticket_fields-ticket_fields]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-ticket_metric_events-zendesk_ticket_metric_events-zendesk_ticket_metric_events-ticket_metric_events]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-tickets-zendesk_tickets-zendesk_tickets-tickets]": 18.0,
+ "posthog/temporal/tests/data_imports/test_end_to_end.py::test_zendesk_source[v3-users-zendesk_users-zendesk_users-users]": 18.0,
"posthog/temporal/tests/data_imports/test_google_ads_source.py::TestGoogleAdsClientStaleConnection::test_oauth_client_closes_stale_connections_before_integration_lookup": 0.01,
"posthog/temporal/tests/data_imports/test_google_ads_source.py::TestGoogleAdsClientStaleConnection::test_service_account_client_does_not_touch_django_connections": 0.01,
"posthog/temporal/tests/data_imports/test_google_ads_source.py::TestGoogleAdsSourceResumableBinding::test_get_resumable_source_manager_round_trips_resume_config": 0.01,
@@ -51318,4 +51299,4 @@
"products/workflows/backend/utils/test_rrule_utils.py::TestRRuleUtils::test_validate_rrule_rejects_invalid_strings_2_": 0.01,
"products/workflows/backend/utils/test_rrule_utils.py::TestRRuleUtils::test_validate_rrule_rejects_invalid_strings_3_DTSTART_20260101T000000_RRULE_FREQ_DAILY": 0.01,
"products/workflows/backend/utils/test_rrule_utils.py::TestRRuleUtils::test_validate_rrule_rejects_invalid_strings_4_BYDAY_MO": 0.5317307999999912
-}
+}
\ No newline at end of file
diff --git a/posthog/temporal/AGENTS.md b/posthog/temporal/AGENTS.md
new file mode 100644
index 000000000000..2c5695eea5b0
--- /dev/null
+++ b/posthog/temporal/AGENTS.md
@@ -0,0 +1,23 @@
+# Working in `posthog/temporal/`
+
+Pointers, not content. Read the linked docs before changing code or tests in this tree.
+
+## Background on what lives here
+
+- [Temporal at PostHog](./README.md) — concepts, workflows, activities, the conventions we use, common pitfalls, links to the upstream Temporal SDK docs.
+
+## Writing or modifying tests in this tree
+
+- [Testing patterns](./README.md#testing-patterns) — when to use real Worker vs `ActivityEnvironment` vs no harness, why some files need `@pytest.mark.django_db(transaction=True)`, the module-scoped Worker pattern that avoids booting the temporal-test-server per test, the `connection.connect()` monkeypatch escape hatch, and the parametrize-don't-copy-paste rule.
+
+## Subtree-specific docs (read when working in that area)
+
+- [`data_imports/`](./data_imports/README.md) — data warehouse import pipelines.
+- [`data_modeling/`](./data_modeling/AGENTS.md) — v1 frozen / v2 active split.
+- [`data_imports/signals/`](./data_imports/signals/AGENTS.md) — signal emission for data-imports events.
+- [`sync_person_distinct_ids/`](./sync_person_distinct_ids/README.md), [`experiments/`](./experiments/README.md), [`weekly_digest/`](./weekly_digest/README.md), [`ingestion_acceptance_test/`](./ingestion_acceptance_test/README.md), [`health_checks/`](./health_checks/README.md), [`llm_analytics/trace_summarization/`](./llm_analytics/trace_summarization/README.md) — each has its own README for context.
+
+## Running tests locally
+
+- Activities and most workflows can be tested without spinning up the dev stack: `pytest posthog/temporal/path/to/your_test.py`. Some require the temporal docker service — see the [Local development](./README.md#local-development) section of the main README.
+- Batch-export destination tests have extra setup (real BigQuery / Redshift / Databricks credentials). See [`products/batch_exports/backend/tests/temporal/README.md`](../../products/batch_exports/backend/tests/temporal/README.md).
diff --git a/posthog/temporal/CLAUDE.md b/posthog/temporal/CLAUDE.md
new file mode 120000
index 000000000000..47dc3e3d863c
--- /dev/null
+++ b/posthog/temporal/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/posthog/temporal/README.md b/posthog/temporal/README.md
index 26ed371aab0a..10e752c1d74e 100644
--- a/posthog/temporal/README.md
+++ b/posthog/temporal/README.md
@@ -481,11 +481,97 @@ Some products or features may require additional configuration, for example: Dat
As you run workflows, you will be able to see the logs in the worker's logs, and you can go to the Temporal UI at http://localhost:8081 to check on the workflow status.
+## Testing patterns
+
+Temporal tests are expensive — they boot Temporal test servers, register activities, and frequently force the slow `TransactionTestCase` isolation mode. The cost is real (per-test TRUNCATE across multiple databases), so write them deliberately.
+
+### Pick the lightest harness that proves what you need
+
+| Harness | When to use | Cost |
+| --------------------------------------------------------- | ---------------------------------------------------------------------------- | -------------------------- |
+| Pure pytest (no Worker, no `ActivityEnvironment`) | Unit-testing pure functions — prompt builders, parsers, decision trees | ~ms/test |
+| `ActivityEnvironment` | Testing a single activity's body in isolation; no workflow orchestration | ~tens of ms/test |
+| Real Worker + `WorkflowEnvironment.start_time_skipping()` | Integration tests that exercise workflow ↔ activity orchestration end-to-end | seconds/test + Worker boot |
+
+Per Temporal's own guidance: write the **majority** of tests as the cheapest harness that still proves the contract you care about. Spinning up a Worker is a deliberate choice for integration tests, not the default.
+
+### The `django_db(transaction=True)` rule
+
+Async tests that touch the Django ORM via `sync_to_async` / `database_sync_to_async` will fail without `@pytest.mark.django_db(transaction=True)`. asgiref dispatches the wrapped sync function to a separate thread, which gets its own DB connection, which can't see the test's wrapping atomic transaction. The test will create a row, the activity will fail to find it.
+
+`transaction=True` swaps fast transaction-rollback for slow TRUNCATE-everything between tests. This is the correct workaround — there's no clean way to share a Django connection across threads — but it's expensive, so **only use it when needed**:
+
+```python
+# Async test + Django ORM = needs transaction=True
[email protected]_db(transaction=True)
+async def test_my_activity(team):
+ source = await sync_to_async(ExternalDataSource.objects.create)(team=team, ...)
+ result = await my_activity(SomeInputs(source_id=source.pk))
+ assert result.ok
+
+# Sync test or no ORM = does NOT need transaction=True
[email protected]_db # transaction rollback — much faster
+def test_my_pure_function(team):
+ source = ExternalDataSource.objects.create(team=team, ...)
+ assert build_query(source) == "..."
+```
+
+### Sharing `WorkflowEnvironment` + `Worker` across tests is tempting but brittle
+
+`WorkflowEnvironment.start_time_skipping()` spawns a real `temporal-test-server` process; `Worker(...)` registers every workflow + activity. Booting them per-test is expensive and the obvious optimization is a module-scoped autouse fixture that boots once and yields a shared client.
+
+**We tried this on `test_end_to_end.py` and reverted it (PR #59405).** The savings were real on most tests (~8s per invocation) but specific tests interact with process-wide state — mocking `ShutdownMonitor.raise_if_is_worker_shutdown`, patching `ee.api.billing.requests.get` and `posthog.cloud_utils.is_instance_licensed_cached` — in ways that, once applied to the shared Worker's activity-executor threads, take minutes to recover from after the test's mock context exits. The worker-shutdown tests were the obvious case; the billing-limits tests surfaced next; the pattern was likely not exhaustive. The CI cost regression outweighed the saving.
+
+If you want to try sharing again, the safe pre-condition is: **no test in the file mocks or patches a target the shared Worker's threads can reach during workflow execution.** That's hard to verify by inspection, so escape hatches end up necessary. The pattern works fine in principle but needs per-file judgement, not a blanket optimization.
+
+### Watch for production code that calls `connection.connect()`
+
+Some activities call `django.db.connection.connect()` explicitly to recover from stale worker connections in production. Under test that drops the test's wrapping atomic — the next ORM read on the (new) connection sees no data, and teardown fails with `TransactionManagementError: The rollback flag doesn't work outside of an 'atomic' block`.
+
+Targeted fix in the test file (or a `conftest.py` for the whole package): no-op the reconnect during tests.
+
+```python
[email protected](autouse=True)
+def _no_worker_reconnect(monkeypatch):
+ from django.db import connection
+ monkeypatch.setattr(connection, "connect", lambda: None)
+```
+
+With this fixture the test can stay on fast `@pytest.mark.django_db` (no `transaction=True`). See `posthog/temporal/proxy_service/test/test_send_proxy_email.py` for a real example.
+
+### Don't copy-paste; parametrize
+
+It's tempting to write "one test per endpoint" when adding source variants. The temptation produces files like the historical state of `test_end_to_end.py`: 83 mechanically identical 10-line tests differing only in fixture name. Each one paid the full per-test cost.
+
+Prefer `@pytest.mark.parametrize`:
+
+```python
[email protected]_db(transaction=True)
+ "schema_name,table_name,fixture_name",
+ [
+ ("charge", "stripe_charge", "stripe_charge"),
+ ("customer", "stripe_customer", "stripe_customer"),
+ # ... etc — adding a new endpoint is now appending a tuple
+ ],
+)
+async def test_stripe_source(team, mock_stripe_client, request, schema_name, table_name, fixture_name):
+ fixture_data = request.getfixturevalue(fixture_name)
+ await _run(team=team, schema_name=schema_name, table_name=table_name,
+ source_type="Stripe", job_inputs=_STRIPE_JOB_INPUTS,
+ mock_data_response=fixture_data["data"])
+```
+
+The per-test cost is the same as N separate functions, but the file shrinks and adding endpoints stops feeling like a refactor.
+
## Relevant documentation
- [Documentation for the Temporal Python SDK](https://docs.temporal.io/develop/python).
- [Documentation on Temporal schedules](https://docs.temporal.io/evaluate/development-production-features/schedules).
- [Documentation on different types of activities](https://docs.temporal.io/develop/python/python-sdk-sync-vs-async).
+- [Documentation on testing Temporal applications](https://docs.temporal.io/develop/python/best-practices/testing-suite).
- [Temporal Python SDK repository](https://github.com/temporalio/sdk-python).
- [Temporal Python SDK code samples](https://github.com/temporalio/samples-python).
diff --git a/posthog/temporal/tests/data_imports/test_end_to_end.py b/posthog/temporal/tests/data_imports/test_end_to_end.py
index 1dc51fcb4639..0a44e2abfc2e 100644
--- a/posthog/temporal/tests/data_imports/test_end_to_end.py
+++ b/posthog/temporal/tests/data_imports/test_end_to_end.py
@@ -648,34 +648,63 @@ async def _execute_run(workflow_id: str, inputs: ExternalDataWorkflowInputs, moc
)
+_STRIPE_JOB_INPUTS: dict[str, str | dict[str, str]] = {
+ "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
+ "stripe_account_id": "acct_id",
+}
+
+
@pytest.mark.django_db(transaction=True)
@pytest.mark.asyncio
-async def test_stripe_balance_transactions(team, stripe_balance_transaction, mock_stripe_client):
+ "schema_name,table_name,fixture_name",
+ [
+ (STRIPE_BALANCE_TRANSACTION_RESOURCE_NAME, "stripe_balancetransaction", "stripe_balance_transaction"),
+ (STRIPE_CUSTOMER_RESOURCE_NAME, "stripe_customer", "stripe_customer"),
+ (STRIPE_INVOICE_RESOURCE_NAME, "stripe_invoice", "stripe_invoice"),
+ (STRIPE_PRICE_RESOURCE_NAME, "stripe_price", "stripe_price"),
+ (STRIPE_PRODUCT_RESOURCE_NAME, "stripe_product", "stripe_product"),
+ (STRIPE_SUBSCRIPTION_RESOURCE_NAME, "stripe_subscription", "stripe_subscription"),
+ (STRIPE_DISPUTE_RESOURCE_NAME, "stripe_dispute", "stripe_dispute"),
+ (STRIPE_PAYOUT_RESOURCE_NAME, "stripe_payout", "stripe_payout"),
+ (STRIPE_REFUND_RESOURCE_NAME, "stripe_refund", "stripe_refund"),
+ (STRIPE_INVOICE_ITEM_RESOURCE_NAME, "stripe_invoiceitem", "stripe_invoiceitem"),
+ (STRIPE_CREDIT_NOTE_RESOURCE_NAME, "stripe_creditnote", "stripe_credit_note"),
+ (
+ STRIPE_CUSTOMER_BALANCE_TRANSACTION_RESOURCE_NAME,
+ "stripe_customerbalancetransaction",
+ "stripe_customer_balance_transaction",
+ ),
+ (
+ STRIPE_CUSTOMER_PAYMENT_METHOD_RESOURCE_NAME,
+ "stripe_customerpaymentmethod",
+ "stripe_customer_payment_method",
+ ),
+ ],
+)
+async def test_stripe_source(team, mock_stripe_client, request, schema_name, table_name, fixture_name):
+ fixture_data = request.getfixturevalue(fixture_name)
await _run(
team=team,
- schema_name=STRIPE_BALANCE_TRANSACTION_RESOURCE_NAME,
- table_name="stripe_balancetransaction",
+ schema_name=schema_name,
+ table_name=table_name,
source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_balance_transaction["data"],
+ job_inputs=_STRIPE_JOB_INPUTS,
+ mock_data_response=fixture_data["data"],
)
@pytest.mark.django_db(transaction=True)
@pytest.mark.asyncio
async def test_stripe_charges(team, stripe_charge, mock_stripe_client):
+ # Kept standalone: also asserts that the revenue analytics first-sync
+ # notification flag gets set after a successful charges sync.
await _run(
team=team,
schema_name=STRIPE_CHARGE_RESOURCE_NAME,
table_name="stripe_charge",
source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
+ job_inputs=_STRIPE_JOB_INPUTS,
mock_data_response=stripe_charge["data"],
)
@@ -684,378 +713,68 @@ async def test_stripe_charges(team, stripe_charge, mock_stripe_client):
assert team.revenue_analytics_config.notified_first_sync
[email protected]_db(transaction=True)
-async def test_stripe_customer(team, stripe_customer, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_CUSTOMER_RESOURCE_NAME,
- table_name="stripe_customer",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_customer["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_invoice(team, stripe_invoice, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_INVOICE_RESOURCE_NAME,
- table_name="stripe_invoice",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_invoice["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_price(team, stripe_price, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_PRICE_RESOURCE_NAME,
- table_name="stripe_price",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_price["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_product(team, stripe_product, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_PRODUCT_RESOURCE_NAME,
- table_name="stripe_product",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_product["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_subscription(team, stripe_subscription, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_SUBSCRIPTION_RESOURCE_NAME,
- table_name="stripe_subscription",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_subscription["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_dispute(team, stripe_dispute, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_DISPUTE_RESOURCE_NAME,
- table_name="stripe_dispute",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_dispute["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_payout(team, stripe_payout, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_PAYOUT_RESOURCE_NAME,
- table_name="stripe_payout",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_payout["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_refund(team, stripe_refund, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_REFUND_RESOURCE_NAME,
- table_name="stripe_refund",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_refund["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_invoiceitem(team, stripe_invoiceitem, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_INVOICE_ITEM_RESOURCE_NAME,
- table_name="stripe_invoiceitem",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_invoiceitem["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_credit_note(team, stripe_credit_note, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_CREDIT_NOTE_RESOURCE_NAME,
- table_name="stripe_creditnote",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_credit_note["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_stripe_customer_balance_transaction(team, stripe_customer_balance_transaction, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_CUSTOMER_BALANCE_TRANSACTION_RESOURCE_NAME,
- table_name="stripe_customerbalancetransaction",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_customer_balance_transaction["data"],
- )
+_ZENDESK_JOB_INPUTS: dict[str, str | dict[str, str]] = {
+ "subdomain": "test",
+ "api_key": "test_api_key",
+ "email_address": "[email protected]",
+}
@pytest.mark.django_db(transaction=True)
@pytest.mark.asyncio
-async def test_stripe_customer_payment_method(team, stripe_customer_payment_method, mock_stripe_client):
- await _run(
- team=team,
- schema_name=STRIPE_CUSTOMER_PAYMENT_METHOD_RESOURCE_NAME,
- table_name="stripe_customerpaymentmethod",
- source_type="Stripe",
- job_inputs={
- "auth_method": {"selection": "api_key", "stripe_secret_key": "test-key"},
- "stripe_account_id": "acct_id",
- },
- mock_data_response=stripe_customer_payment_method["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_brands(team, zendesk_brands):
- await _run(
- team=team,
- schema_name="brands",
- table_name="zendesk_brands",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_brands["brands"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_organizations(team, zendesk_organizations):
- await _run(
- team=team,
- schema_name="organizations",
- table_name="zendesk_organizations",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_organizations["organizations"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_groups(team, zendesk_groups):
- await _run(
- team=team,
- schema_name="groups",
- table_name="zendesk_groups",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_groups["groups"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_sla_policies(team, zendesk_sla_policies):
- await _run(
- team=team,
- schema_name="sla_policies",
- table_name="zendesk_sla_policies",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_sla_policies["sla_policies"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_users(team, zendesk_users):
- await _run(
- team=team,
- schema_name="users",
- table_name="zendesk_users",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_users["users"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_ticket_fields(team, zendesk_ticket_fields):
- await _run(
- team=team,
- schema_name="ticket_fields",
- table_name="zendesk_ticket_fields",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_ticket_fields["ticket_fields"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_ticket_events(team, zendesk_ticket_events):
- await _run(
- team=team,
- schema_name="ticket_events",
- table_name="zendesk_ticket_events",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_ticket_events["ticket_events"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_zendesk_tickets(team, zendesk_tickets):
+ "schema_name,table_name,fixture_name,fixture_data_key",
+ [
+ ("brands", "zendesk_brands", "zendesk_brands", "brands"),
+ ("organizations", "zendesk_organizations", "zendesk_organizations", "organizations"),
+ ("groups", "zendesk_groups", "zendesk_groups", "groups"),
+ ("sla_policies", "zendesk_sla_policies", "zendesk_sla_policies", "sla_policies"),
+ ("users", "zendesk_users", "zendesk_users", "users"),
+ ("ticket_fields", "zendesk_ticket_fields", "zendesk_ticket_fields", "ticket_fields"),
+ ("ticket_events", "zendesk_ticket_events", "zendesk_ticket_events", "ticket_events"),
+ ("tickets", "zendesk_tickets", "zendesk_tickets", "tickets"),
+ (
+ "ticket_metric_events",
+ "zendesk_ticket_metric_events",
+ "zendesk_ticket_metric_events",
+ "ticket_metric_events",
+ ),
+ ],
+)
+async def test_zendesk_source(team, request, schema_name, table_name, fixture_name, fixture_data_key):
+ fixture_data = request.getfixturevalue(fixture_name)
await _run(
team=team,
- schema_name="tickets",
- table_name="zendesk_tickets",
+ schema_name=schema_name,
+ table_name=table_name,
source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_tickets["tickets"],
+ job_inputs=_ZENDESK_JOB_INPUTS,
+ mock_data_response=fixture_data[fixture_data_key],
)
[email protected]_db(transaction=True)
-async def test_zendesk_ticket_metric_events(team, zendesk_ticket_metric_events):
- await _run(
- team=team,
- schema_name="ticket_metric_events",
- table_name="zendesk_ticket_metric_events",
- source_type="Zendesk",
- job_inputs={
- "subdomain": "test",
- "api_key": "test_api_key",
- "email_address": "[email protected]",
- },
- mock_data_response=zendesk_ticket_metric_events["ticket_metric_events"],
- )
+_PADDLE_JOB_INPUTS: dict[str, str | dict[str, str]] = {"paddle_api_key": "test_api_key"}
@pytest.mark.django_db(transaction=True)
@pytest.mark.asyncio
-async def test_paddle_customers(team, paddle_customers, mock_paddle_client):
- mock_paddle_client(paddle_customers["data"])
-
- await _run(
- team=team,
- schema_name="customers",
- table_name="paddle_customers",
- source_type="Paddle",
- job_inputs={"paddle_api_key": "test_api_key"},
- mock_data_response=paddle_customers["data"],
- )
-
-
[email protected]_db(transaction=True)
-async def test_paddle_subscriptions(team, paddle_subscriptions, mock_paddle_client):
- mock_paddle_client(paddle_subscriptions["data"])
-
+ "schema_name,table_name,fixture_name",
+ [
+ ("customers", "paddle_customers", "paddle_customers"),
+ ("subscriptions", "paddle_subscriptions", "paddle_subscriptions"),
+ ],
+)
+async def test_paddle_source(team, mock_paddle_client, request, schema_name, table_name, fixture_name):
+ fixture_data = request.getfixturevalue(fixture_name)
+ mock_paddle_client(fixture_data["data"])
await _run(
team=team,
- schema_name="subscriptions",
- table_name="paddle_subscriptions",
+ schema_name=schema_name,
+ table_name=table_name,
source_type="Paddle",
- job_inputs={"paddle_api_key": "test_api_key"},
- mock_data_response=paddle_subscriptions["data"],
+ job_inputs=_PADDLE_JOB_INPUTS,
+ mock_data_response=fixture_data["data"],
)
@@ -1073,131 +792,32 @@ async def _run_customer_io(team, schema_name, table_name, mock_data, mock_custom
@pytest.mark.django_db(transaction=True)
@pytest.mark.asyncio
-async def test_customer_io_broadcasts(team, customer_io_broadcasts, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="broadcasts",
- table_name="customerio_broadcasts",
- mock_data=customer_io_broadcasts["broadcasts"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_broadcasts,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_campaigns(team, customer_io_campaigns, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="campaigns",
- table_name="customerio_campaigns",
- mock_data=customer_io_campaigns["campaigns"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_campaigns,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_collections(team, customer_io_collections, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="collections",
- table_name="customerio_collections",
- mock_data=customer_io_collections["collections"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_collections,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_newsletters(team, customer_io_newsletters, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="newsletters",
- table_name="customerio_newsletters",
- mock_data=customer_io_newsletters["newsletters"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_newsletters,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_object_types(team, customer_io_object_types, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="object_types",
- table_name="customerio_object_types",
- mock_data=customer_io_object_types["types"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_object_types,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_segments(team, customer_io_segments, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="segments",
- table_name="customerio_segments",
- mock_data=customer_io_segments["segments"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_segments,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_sender_identities(team, customer_io_sender_identities, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="sender_identities",
- table_name="customerio_sender_identities",
- mock_data=customer_io_sender_identities["sender_identities"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_sender_identities,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_snippets(team, customer_io_snippets, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="snippets",
- table_name="customerio_snippets",
- mock_data=customer_io_snippets["snippets"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_snippets,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_subscription_topics(team, customer_io_subscription_topics, mock_customer_io_client):
- await _run_customer_io(
- team,
- schema_name="subscription_topics",
- table_name="customerio_subscription_topics",
- mock_data=customer_io_subscription_topics["topics"],
- mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_subscription_topics,
- )
-
-
[email protected]_db(transaction=True)
-async def test_customer_io_transactional(team, customer_io_transactional, mock_customer_io_client):
+ "schema_name,table_name,fixture_name,fixture_data_key",
+ [
+ ("broadcasts", "customerio_broadcasts", "customer_io_broadcasts", "broadcasts"),
+ ("campaigns", "customerio_campaigns", "customer_io_campaigns", "campaigns"),
+ ("collections", "customerio_collections", "customer_io_collections", "collections"),
+ ("newsletters", "customerio_newsletters", "customer_io_newsletters", "newsletters"),
+ ("object_types", "customerio_object_types", "customer_io_object_types", "types"),
+ ("segments", "customerio_segments", "customer_io_segments", "segments"),
+ ("sender_identities", "customerio_sender_identities", "customer_io_sender_identities", "sender_identities"),
+ ("snippets", "customerio_snippets", "customer_io_snippets", "snippets"),
+ ("subscription_topics", "customerio_subscription_topics", "customer_io_subscription_topics", "topics"),
+ ("transactional", "customerio_transactional", "customer_io_transactional", "messages"),
+ ],
+)
+async def test_customer_io_source(
+ team, mock_customer_io_client, request, schema_name, table_name, fixture_name, fixture_data_key
+):
+ fixture_data = request.getfixturevalue(fixture_name)
await _run_customer_io(
team,
- schema_name="transactional",
- table_name="customerio_transactional",
- mock_data=customer_io_transactional["messages"],
+ schema_name=schema_name,
+ table_name=table_name,
+ mock_data=fixture_data[fixture_data_key],
mock_customer_io_client=mock_customer_io_client,
- payload=customer_io_transactional,
+ payload=fixture_data,
)