Skip to content

test clock reset/delete: fixture 재적용이 시계를 되돌리지 못해 trial 전제가 회차 간 소진된다 #76

Description

@midagedev

증상

POST /v1/test_helpers/test_clocks/{id}/advance 는 전진만 허용한다 (과거 frozen_time → 400).
DELETE / reset 이 없어서, 한 번 advance 한 시계는 billtap.db 를 재생성하기 전까지 영구적이다.

E2E 하네스(dentbird uf-verify)에서 실측한 결과:

# clock_trial 을 trial_end+60 으로 advance 한 뒤
$ wget --post-data='frozen_time=1894233600' .../test_clocks/clock_trial/advance   # 과거로
HTTP/1.1 400 Bad Request

# fixture pack 재적용(status: trialing, trial_start/end 명시) 후에도
$ GET /v1/subscriptions?customer=cus_e2e_clock_trial
status=active   # trialing 으로 돌아오지 않는다 — 시계가 trial_end 를 지나 있으므로

결과적으로 「trial 상태에서 시작하는 검증 → trial 만료 advance」 를 한 회차 돌리면,
다음 회차의 trial 전제가 소진된다. fixture 재적용(멱등 복원)의 설계 의도와 어긋난다.

제안

Stripe 호환 DELETE /v1/test_helpers/test_clocks/{id} (실제 Stripe 에 존재).
삭제 시 부착 구독 처리는 Stripe 시맨틱(부착 객체 삭제) 또는 billtap 단순화(detach) 중 택일.
fixture 재적용이 test_clock: 선언을 보고 「시계가 fixture 의 기대 시점보다 미래면 재생성」
하는 경로가 붙으면 복원이 완전 멱등이 된다.

맥락

  • 하네스 쪽은 당장 전제 가드(clock advanced → skip)로 위양성 FAIL 만 막아둔 상태.
  • 관련: fixture 재적용 patch 는 cancel_at_period_end 를 fixture 에 명시했을 때만 되돌린다
    (이번에 yml 에 핀으로 해결) — 시계는 같은 방법이 없다.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions