: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(batch-exports): stop generating always-skipped destination test cases (#99305)
Georges-Antoine Assi9ffc6356405c
diff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.pyindex 300264eb0460..50a2de4107a2 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_activity.py@@ -8,7 +8,6 @@ from posthog.temporal.tests.utils.events import generate_test_events_in_clickhoufrom products.batch_exports.backend.service import BatchExportModelfrom products.batch_exports.backend.temporal.destinations.azure_blob_batch_export import (- SUPPORTED_COMPRESSIONS,AzureBlobInsertInputs,azure_blob_default_fields,insert_into_azure_blob_activity_from_stage,@@ -18,6 +17,7 @@ from products.batch_exports.backend.temporal.pipeline.internal_stage import (insert_into_internal_stage_activity,)from products.batch_exports.backend.tests.temporal.destinations.azure_blob.utils import (+ SUPPORTED_FILE_FORMAT_COMPRESSIONS,TEST_AZURE_BLOB_MODELS,assert_clickhouse_records_in_azure_blob,list_blobs,@@ -59,6 +59,7 @@ async def run_activity()[email protected](("file_format", "compression"), SUPPORTED_FILE_FORMAT_COMPRESSIONS, indirect=True)@pytest.mark.parametrize("model", TEST_AZURE_BLOB_MODELS)async def test_activity_exports_model_to_azure_blob(activity_environment: ActivityEnvironment,@@ -75,9 +76,6 @@ async def test_activity_exports_model_to_azure_blob(model,):"""Test that events, persons, and sessions are exported to Azure Blob Storage."""- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-batch_export_schema = Nonebatch_export_model = Noneif isinstance(model, BatchExportModel):diff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.pyindex a97a5f58a906..d39f56663369 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_execution.py@@ -1,8 +1,8 @@import pytestfrom products.batch_exports.backend.service import BatchExportModel, BatchExportSchema-from products.batch_exports.backend.temporal.destinations.azure_blob_batch_export import SUPPORTED_COMPRESSIONSfrom products.batch_exports.backend.tests.temporal.destinations.azure_blob.utils import (+ SUPPORTED_FILE_FORMAT_COMPRESSIONS,TEST_AZURE_BLOB_MODELS,assert_clickhouse_records_in_azure_blob,list_blobs,@@ -13,6 +13,7 @@ pytestmark = [pytest.mark.asyncio, pytest.mark.django_db]@pytest.mark.parametrize("interval", ["hour", "day"], indirect=True)[email protected](("file_format", "compression"), SUPPORTED_FILE_FORMAT_COMPRESSIONS, indirect=True)@pytest.mark.parametrize("model", TEST_AZURE_BLOB_MODELS)async def test_workflow_exports_model_successfully(ateam,@@ -29,9 +30,6 @@ async def test_workflow_exports_model_successfully(model: BatchExportModel | BatchExportSchema | None,):"""Test that the workflow exports events, persons, or sessions to Azure Blob Storage."""- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-batch_export_model = model if isinstance(model, BatchExportModel) else Nonebatch_export_schema = model if isinstance(model, dict) else Nonediff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.pyindex 37e338f86dc1..28f84c325d3f 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/test_workflow_with_azure_account.py@@ -24,8 +24,8 @@ from posthog.models.integration import Integrationfrom products.batch_exports.backend.models.batch_export import BatchExport, BatchExportDestinationfrom products.batch_exports.backend.service import BatchExportModel, BatchExportSchema-from products.batch_exports.backend.temporal.destinations.azure_blob_batch_export import SUPPORTED_COMPRESSIONSfrom products.batch_exports.backend.tests.temporal.destinations.azure_blob.utils import (+ SUPPORTED_FILE_FORMAT_COMPRESSIONS,TEST_AZURE_BLOB_MODELS,assert_clickhouse_records_in_azure_blob,run_azure_blob_batch_export_workflow,@@ -174,8 +174,7 @@ async def test_workflow_exports_data_successfully(@pytest.mark.parametrize("interval", ["hour"], indirect=True)[email protected]("file_format", ["JSONLines", "Parquet"], indirect=True)[email protected]("compression", [None, "gzip", "brotli", "zstd", "lz4", "snappy"], indirect=True)[email protected](("file_format", "compression"), SUPPORTED_FILE_FORMAT_COMPRESSIONS, indirect=True)@pytest.mark.parametrize("model", [BatchExportModel(name="events", schema=None)])async def test_workflow_handles_formats_and_compression(ateam,@@ -192,9 +191,6 @@ async def test_workflow_handles_formats_and_compression(model: BatchExportModel,):"""Test workflow handles various file formats and compression types with real Azure."""- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-run = await run_azure_blob_batch_export_workflow(team=ateam,batch_export_id=str(azure_batch_export.id),diff --git a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.py b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.pyindex 0c26539407ee..afbbfaa4b073 100644--- a/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/azure_blob/utils.py@@ -20,6 +20,8 @@ from posthog.temporal.tests.utils.models import afetch_batch_export_runsfrom products.batch_exports.backend.service import BatchExportModel, BatchExportSchemafrom products.batch_exports.backend.temporal.batch_exports import finish_batch_export_run, start_batch_export_runfrom products.batch_exports.backend.temporal.destinations.azure_blob_batch_export import (+ FILE_FORMAT_EXTENSIONS,+ SUPPORTED_COMPRESSIONS,AzureBlobBatchExportInputs,AzureBlobBatchExportWorkflow,azure_blob_default_fields,@@ -268,6 +270,12 @@ TEST_AZURE_BLOB_MODELS: list[BatchExportModel | BatchExportSchema | None] = [None,]+SUPPORTED_FILE_FORMAT_COMPRESSIONS: list[tuple[str, str | None]] = [+ (file_format, compression)+ for file_format in FILE_FORMAT_EXTENSIONS+ for compression in (None, *SUPPORTED_COMPRESSIONS[file_format])+]+async def run_azure_blob_batch_export_workflow(team,diff --git a/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.py b/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.pyindex 9b0d513aec84..b9bba0152a8a 100644--- a/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/file_download/test_file_download_activity.py@@ -17,17 +17,13 @@ from products.batch_exports.backend.temporal.destinations.file_download_batch_exexport_to_file_download_bucket_with_temporary_credentials,generate_file_downloads,)-from products.batch_exports.backend.temporal.destinations.s3_batch_export import (- COMPRESSION_EXTENSIONS,- FILE_FORMAT_EXTENSIONS,- SUPPORTED_COMPRESSIONS,- s3_default_fields,-)+from products.batch_exports.backend.temporal.destinations.s3_batch_export import s3_default_fieldsfrom products.batch_exports.backend.temporal.pipeline.internal_stage import (BatchExportInsertIntoInternalStageInputs,insert_into_internal_stage_activity,)from products.batch_exports.backend.tests.temporal.destinations.s3.utils import (+ SUPPORTED_FILE_FORMAT_COMPRESSIONS,TEST_S3_MODELS,assert_clickhouse_records_in_s3,has_valid_credentials,@@ -43,9 +39,8 @@ pytestmark = [][email protected]("compression", COMPRESSION_EXTENSIONS.keys(), indirect=True)[email protected](("file_format", "compression"), SUPPORTED_FILE_FORMAT_COMPRESSIONS, indirect=["compression"])@pytest.mark.parametrize("model", TEST_S3_MODELS)[email protected]("file_format", FILE_FORMAT_EXTENSIONS.keys())async def test_export_to_file_download_bucket_puts_data_into_s3(clickhouse_client,activity_environment: ActivityEnvironment,@@ -68,9 +63,6 @@ async def test_export_to_file_download_bucket_puts_data_into_s3(S3InsertInputs, and delegates to insert_into_s3_from_stage. We verifythe data ends up in the expected S3 location and matches what ClickHouse produces."""- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-batch_export_schema: BatchExportSchema | None = Nonebatch_export_model: BatchExportModel | None = Noneif isinstance(model, BatchExportModel):diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.pyindex fe47966ed5c6..11ab09f03c18 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity.py@@ -11,13 +11,14 @@ from products.batch_exports.backend.service import BatchExportModel, BatchExportfrom products.batch_exports.backend.temporal.destinations.s3_batch_export import (COMPRESSION_EXTENSIONS,FILE_FORMAT_EXTENSIONS,- SUPPORTED_COMPRESSIONS,S3InsertInputs,_get_s3_integration,insert_into_s3_activity_from_stage,s3_default_fields,)from products.batch_exports.backend.tests.temporal.destinations.s3.utils import (+ SPLIT_FILE_FORMAT_COMPRESSIONS,+ SUPPORTED_FILE_FORMAT_COMPRESSIONS,TEST_S3_MODELS,assert_clickhouse_records_in_s3,run_activity,@@ -72,9 +73,8 @@ async def test_insert_into_s3_activity_fails_without_an_integration(activity_envassert result.error.type == "MissingIntegrationError"[email protected]("compression", COMPRESSION_EXTENSIONS.keys(), indirect=True)[email protected](("file_format", "compression"), SUPPORTED_FILE_FORMAT_COMPRESSIONS, indirect=["compression"])@pytest.mark.parametrize("model", TEST_S3_MODELS)[email protected]("file_format", FILE_FORMAT_EXTENSIONS.keys())async def test_insert_into_s3_activity_puts_data_into_s3(clickhouse_client,bucket_name,@@ -104,9 +104,6 @@ async def test_insert_into_s3_activity_puts_data_into_s3(that they appear in the expected S3 bucket and key."""- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-prefix = str(uuid.uuid4())batch_export_schema: BatchExportSchema | None = None@@ -330,9 +327,8 @@ async def test_insert_into_s3_activity_with_exclude_events()[email protected]("compression", [*COMPRESSION_EXTENSIONS.keys(), None], indirect=True)[email protected](("file_format", "compression"), SPLIT_FILE_FORMAT_COMPRESSIONS, indirect=["compression"])@pytest.mark.parametrize("model", [BatchExportModel(name="events", schema=None)])[email protected]("file_format", FILE_FORMAT_EXTENSIONS.keys())@pytest.mark.parametrize("max_file_size_mb", [None, 6])async def test_insert_into_s3_activity_puts_splitted_files_into_s3(clickhouse_client,@@ -357,12 +353,6 @@ async def test_insert_into_s3_activity_puts_splitted_files_into_s3(This test needs to generate a lot of data to ensure that the file is large enough to be split up."""- if file_format == "JSONLines" and compression is not None:- pytest.skip("Compressing large JSONLines files takes too long to run; skipping for now")-- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-prefix = str(uuid.uuid4())events_1, _, _ = await generate_test_events_in_clickhouse(diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.pyindex d27d62f2a2b0..2dae3c5fc36e 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_gcs_bucket.py@@ -13,11 +13,12 @@ from products.batch_exports.backend.service import BatchExportModel, BatchExportfrom products.batch_exports.backend.temporal.destinations.s3_batch_export import (COMPRESSION_EXTENSIONS,FILE_FORMAT_EXTENSIONS,- SUPPORTED_COMPRESSIONS,S3InsertInputs,s3_default_fields,)from products.batch_exports.backend.tests.temporal.destinations.s3.utils import (+ SPLIT_FILE_FORMAT_COMPRESSIONS,+ SUPPORTED_FILE_FORMAT_COMPRESSIONS,TEST_S3_MODELS,assert_clickhouse_records_in_s3,has_valid_gcs_credentials,@@ -53,9 +54,8 @@ async def gcs_client(bucket_name, s3_key_prefix):await delete_all_from_s3(s3_client, bucket_name, key_prefix=s3_key_prefix)[email protected]("compression", COMPRESSION_EXTENSIONS.keys(), indirect=True)[email protected](("file_format", "compression"), SUPPORTED_FILE_FORMAT_COMPRESSIONS, indirect=["compression"])@pytest.mark.parametrize("model", TEST_S3_MODELS)[email protected]("file_format", FILE_FORMAT_EXTENSIONS.keys())async def test_insert_into_s3_activity_puts_data_into_gcs(clickhouse_client,bucket_name,@@ -85,9 +85,6 @@ async def test_insert_into_s3_activity_puts_data_into_gcs(that they appear in the expected GCS bucket and key."""- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-prefix = str(uuid.uuid4())batch_export_schema: BatchExportSchema | None = None@@ -156,9 +153,8 @@ async def test_insert_into_s3_activity_puts_data_into_gcs()[email protected]("compression", [*COMPRESSION_EXTENSIONS.keys(), None], indirect=True)[email protected](("file_format", "compression"), SPLIT_FILE_FORMAT_COMPRESSIONS, indirect=["compression"])@pytest.mark.parametrize("model", [BatchExportModel(name="events", schema=None)])[email protected]("file_format", FILE_FORMAT_EXTENSIONS.keys())@pytest.mark.parametrize("max_file_size_mb", [None, 6])async def test_insert_into_s3_activity_puts_splitted_files_into_gcs(clickhouse_client,@@ -183,12 +179,6 @@ async def test_insert_into_s3_activity_puts_splitted_files_into_gcs(This test needs to generate a lot of data to ensure that the file is large enough to be split up."""- if file_format == "JSONLines" and compression is not None:- pytest.skip("Compressing large JSONLines files takes too long to run; skipping for now")-- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-prefix = str(uuid.uuid4())events_1, _, _ = await generate_test_events_in_clickhouse(diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_role_assumption.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_role_assumption.pyindex d98f2bce1957..4d1b1dd53ddc 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_role_assumption.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_activity_with_role_assumption.py@@ -21,9 +21,14 @@ from products.batch_exports.backend.temporal.destinations.s3_batch_export import)from products.batch_exports.backend.tests.temporal.destinations.s3.utils import (assert_clickhouse_records_in_s3,+ has_valid_credentials,run_activity,)+pytestmark = [+ pytest.mark.skipif(not has_valid_credentials(), reason="AWS credentials not set in environment"),+]+@pytest.fixture(scope="module")def bucket_name(request) -> str:diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.py b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.pyindex 4f8566c06514..ac26659fcd12 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/test_workflow_with_local_object_storage.py@@ -3,13 +3,11 @@ import datetime as dtimport pytestfrom products.batch_exports.backend.service import BackfillDetails, BatchExportModel, BatchExportSchema-from products.batch_exports.backend.temporal.destinations.s3_batch_export import (- COMPRESSION_EXTENSIONS,- FILE_FORMAT_EXTENSIONS,- SUPPORTED_COMPRESSIONS,-)from products.batch_exports.backend.tests.temporal.destinations.s3.utils import (+ SUPPORTED_FILE_FORMAT_COMPRESSIONS,TEST_S3_MODELS,+ TEST_S3_MODELS_AFFECTED_BY_EXCLUDE_EVENTS,+ UNCOMPRESSED_FILE_FORMATS,run_s3_batch_export_workflow,)@@ -48,9 +46,6 @@ async def test_s3_export_workflow_with_local_object_storage_with_various_models(will require its presence in the database when running. This model is indirectly parameterizedby several fixtures. Refer to them for more information."""- if isinstance(model, BatchExportModel) and model.name == "persons" and exclude_events is not None:- pytest.skip("Unnecessary test case as person batch export is not affected by 'exclude_events'")-await run_s3_batch_export_workflow(model=model,ateam=ateam,@@ -69,8 +64,9 @@ async def test_s3_export_workflow_with_local_object_storage_with_various_models(@pytest.mark.parametrize("interval", ["hour"], indirect=True)@pytest.mark.parametrize("model", [BatchExportModel(name="events", schema=None)])@pytest.mark.parametrize("exclude_events", [None], indirect=True)[email protected]("compression", [*COMPRESSION_EXTENSIONS.keys(), None], indirect=True)[email protected]("file_format", FILE_FORMAT_EXTENSIONS.keys(), indirect=True)+ ("file_format", "compression"), [*SUPPORTED_FILE_FORMAT_COMPRESSIONS, *UNCOMPRESSED_FILE_FORMATS], indirect=True+)async def test_s3_export_workflow_with_local_object_storage_with_various_compression_and_file_formats(clickhouse_client,object_storage_client,@@ -89,9 +85,6 @@ async def test_s3_export_workflow_with_local_object_storage_with_various_compres):"""Test S3BatchExport Workflow end-to-end by using a local object storage bucket and various compression and file formats."""- if compression and compression not in SUPPORTED_COMPRESSIONS[file_format]:- pytest.skip(f"Compression {compression} is not supported for file format {file_format}")-await run_s3_batch_export_workflow(model=model,ateam=ateam,@@ -111,7 +104,7 @@ async def test_s3_export_workflow_with_local_object_storage_with_various_compres@pytest.mark.parametrize("compression", [None], indirect=True)@pytest.mark.parametrize("file_format", ["JSONLines"], indirect=True)@pytest.mark.parametrize("exclude_events", [["test-exclude"]], indirect=True)[email protected]("model", TEST_S3_MODELS)[email protected]("model", TEST_S3_MODELS_AFFECTED_BY_EXCLUDE_EVENTS)async def test_s3_export_workflow_with_local_object_storage_with_exclude_events(clickhouse_client,object_storage_client,@@ -129,9 +122,6 @@ async def test_s3_export_workflow_with_local_object_storage_with_exclude_events(generate_test_data,):"""Test S3BatchExport Workflow end-to-end by using a local object storage bucket and excluding events."""- if isinstance(model, BatchExportModel) and model.name in ["persons", "sessions"]:- pytest.skip(f"Unnecessary test case as {model.name} batch export is not affected by 'exclude_events'")-await run_s3_batch_export_workflow(model=model,ateam=ateam,diff --git a/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py b/products/batch_exports/backend/tests/temporal/destinations/s3/utils.pyindex d2fe00a99a1c..4a2afdd5944f 100644--- a/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py+++ b/products/batch_exports/backend/tests/temporal/destinations/s3/utils.py@@ -32,6 +32,8 @@ from products.batch_exports.backend.service import (from products.batch_exports.backend.temporal.batch_exports import finish_batch_export_run, start_batch_export_runfrom products.batch_exports.backend.temporal.destinations.s3_batch_export import (COMPRESSION_EXTENSIONS,+ FILE_FORMAT_EXTENSIONS,+ SUPPORTED_COMPRESSIONS,S3BatchExportWorkflow,S3InsertInputs,insert_into_s3_activity_from_stage,@@ -93,6 +95,31 @@ TEST_S3_MODELS: list[BatchExportModel | BatchExportSchema | None] = [None,]+TEST_S3_MODELS_AFFECTED_BY_EXCLUDE_EVENTS: list[BatchExportModel | BatchExportSchema | None] = [+ model+ for model in TEST_S3_MODELS+ if not (isinstance(model, BatchExportModel) and model.name in ("persons", "sessions"))+]++SUPPORTED_FILE_FORMAT_COMPRESSIONS: list[tuple[str, str | None]] = [+ (file_format, compression)+ for file_format, compressions in SUPPORTED_COMPRESSIONS.items()+ for compression in compressions+]++UNCOMPRESSED_FILE_FORMATS: list[tuple[str, str | None]] = [+ (file_format, None) for file_format in FILE_FORMAT_EXTENSIONS+]++SPLIT_FILE_FORMAT_COMPRESSIONS: list[tuple[str, str | None]] = [+ *(+ (file_format, compression)+ for file_format, compression in SUPPORTED_FILE_FORMAT_COMPRESSIONS+ if file_format == "Parquet"+ ),+ *UNCOMPRESSED_FILE_FORMATS,+]+async def check_valid_credentials() -> bool:"""Check if there are valid AWS credentials in the environment."""