Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/azure-functions-durable/e2e/_markers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Shared markers for the Azure Functions Durable E2E suite."""

import pytest


azurite_delayed_visibility = pytest.mark.skip(
reason=(
"Azurite intermittently fails to return queue messages after an initial "
"visibility delay; see https://github.com/Azure/Azurite/issues/2343."
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
``configure_history_export`` time, so this route no longer binds a process-wide
context. The route only builds an ``ExportHistoryClient`` for the job-management
surface (create / get job). A local-filesystem writer sends exported history to
``<app>/_export_output`` where the test can read it back.
a temporary directory outside the function app where the test can read it back.
"""

import json
import tempfile
from collections.abc import Mapping
from datetime import datetime, timedelta, timezone
from pathlib import Path
Expand All @@ -44,9 +45,11 @@

bp = df.Blueprint()

# Exported history is written under the app directory so the E2E test (running
# on the same machine) can read it back and assert on the contents.
EXPORT_ROOT = Path(__file__).parent / "_export_output"
# Keep generated files outside the function app. Writing beneath the app root
# triggers the Functions host's file watcher and restarts the host mid-suite.
EXPORT_ROOT = (
Path(tempfile.gettempdir()) / "durabletask-python-e2e" / "history-export"
)


class _FileSystemHistoryWriter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import pytest

from ._markers import azurite_delayed_visibility

pytestmark = pytest.mark.functions_e2e


Expand Down Expand Up @@ -80,6 +82,7 @@ def test_call_failing_entity_handled(dtask_app):
assert status["output"]["caught"] is True


@azurite_delayed_visibility
def test_client_delayed_signal_is_deferred(dtask_app):
key = f"client-delay-{int(time.time() * 1000)}"
dtask_app.signal_entity("counter", key, "add", input=9, delay_seconds=3.0)
Expand All @@ -96,6 +99,7 @@ def test_client_delayed_signal_is_deferred(dtask_app):
assert payload["state"] == 9


@azurite_delayed_visibility
def test_orchestration_delayed_signal_is_deferred(dtask_app):
key = f"orch-delay-{int(time.time() * 1000)}"
instance_id = dtask_app.start_orchestration("signal_counter_delayed", body=key)
Expand Down
3 changes: 3 additions & 0 deletions tests/azure-functions-durable/e2e/test_dtask_patterns_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

import pytest

from ._markers import azurite_delayed_visibility

pytestmark = pytest.mark.functions_e2e


@azurite_delayed_visibility
def test_timer(dtask_app):
instance_id = dtask_app.start_orchestration("timer_wait")
status = dtask_app.wait_for_completion(instance_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@

import pytest

pytestmark = pytest.mark.functions_e2e
from ._markers import azurite_delayed_visibility

pytestmark = [
pytest.mark.functions_e2e,
azurite_delayed_visibility,
]


def test_scheduled_orchestration_fires_repeatedly(dtask_app):
Expand Down
3 changes: 3 additions & 0 deletions tests/azure-functions-durable/e2e/test_v1_patterns_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

import pytest

from ._markers import azurite_delayed_visibility

pytestmark = pytest.mark.functions_e2e


@azurite_delayed_visibility
def test_timer(v1_app):
instance_id = v1_app.start_orchestration("timer_wait")
status = v1_app.wait_for_completion(instance_id)
Expand Down
Loading