Skip to content

Commit a5fb9c8

Browse files
vdusekclaude
andcommitted
test: fix e2e teardown to add FREE pricing record after existing ones
The cleanup in make_actor appended a FREE pricing_info with a hardcoded startedAt='2024-01-01', which the API rejected for actors that already had later-dated pricing records with "The record you are adding must start after all existing records." Compute startedAt as max(latest_existing, now) + 1s so the added record always starts strictly after existing ones. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 88d28b0 commit a5fb9c8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/e2e/conftest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import subprocess
77
import sys
88
import textwrap
9-
from datetime import timedelta
9+
from datetime import UTC, datetime, timedelta
1010
from pathlib import Path
1111
from typing import TYPE_CHECKING, Any, Protocol
1212

@@ -351,13 +351,16 @@ async def _make_actor(
351351
if actor is not None and actor.pricing_infos is not None:
352352
# Convert Pydantic models to dicts before mixing with plain dict
353353
existing_pricing_infos = [pi.model_dump(by_alias=True, exclude_none=True) for pi in actor.pricing_infos]
354+
# The API requires the new record to start strictly after all existing records.
355+
latest_started_at = max(pi.started_at for pi in actor.pricing_infos)
356+
new_started_at = max(latest_started_at, datetime.now(tz=UTC)) + timedelta(seconds=1)
354357
new_pricing_infos = [
355358
*existing_pricing_infos,
356359
{
357360
'pricingModel': 'FREE',
358361
'apifyMarginPercentage': 0.0,
359-
'createdAt': '2024-01-01T00:00:00.000Z',
360-
'startedAt': '2024-01-01T00:00:00.000Z',
362+
'createdAt': new_started_at.isoformat(),
363+
'startedAt': new_started_at.isoformat(),
361364
},
362365
]
363366
actor_client.update(pricing_infos=new_pricing_infos)

0 commit comments

Comments
 (0)