Skip to content

Skip worker dispatch in v2 tests and share completed fixtures - #231

Merged
amarcozzi merged 2 commits into
mainfrom
230-skip-dispatch-tests
Oct 13, 2026
Merged

amarcozzi merged 2 commits into
mainfrom
230-skip-dispatch-tests

Conversation

@amarcozzi

Copy link
Copy Markdown
Contributor

Closes #230

The v2 tests run against the prod API, and every create used to start a real worker job. The API now accepts X-FastFuels-Skip-Dispatch: 1 (silvxlabs/FastFuels-API-v2#681): a request carrying it stores the resource but queues no job. This PR makes the header the default in the v2 tests, and has the tests that need real jobs share completed fixtures.

Real jobs per full pytest v2 run: about 105 → 47.

Changes

Only tests/v2/ changes. The public SDK, the generated client_library and CI are unchanged, and no release is needed.

1. Create-only tests skip dispatch

  • tests/v2/utils.py:
    • install_skip_dispatch_client() swaps the SDK's cached client for a copy that carries the header and keeps a header-free copy.
    • real_dispatch_client() is a context manager that switches to the header-free client.
  • tests/v2/conftest.py: the session autouse fixture skip_dispatch_by_default installs the header client for every test.
  • The default applies to all create, validation, update, list and delete tests, including every *_requires_completed* guard test. Those tests are now guaranteed to see a pending resource.

2. Tests that need real jobs opt in and share completed fixtures

  • A test that waits on a job or reads its results requests the real_dispatch fixture. Fixtures that build completed resources create them inside real_dispatch_client().

  • New shared fixtures:

    Fixture Replaces
    completed_voxel_grid (2 m × 1 m; foliage bulk density, spcd, live moisture, LAD) 4 voxelize jobs: DUET, LeafLux, Fosberg, QUIC-Fire export
    completed_voxel_topography_grid the Fosberg and QUIC-Fire topography jobs
    completed_inventory_csv_export separate CSV exports in test_exports and test_inventories
    covered_3dep_domain / completed_3dep_point_cloud (moved to conftest) the duplicate lakitu job in test_grids
    completed_leaflux_irradiance_grid (module) shared by the LeafLux and Fosberg tests
    completed_throwaway_inventory (module) one duplicate each for the modifications and treatments apply tests
  • Tests that still start their own job test a distinct job type or option:

    • CHM from point cloud, DUET, Fosberg, canopy from inventory, the disturbance band;
    • duplicate, in-place re-derive, the CSV and GeoTIFF uploads;
    • create-time modifications, crown segmentation, measured-crown voxelize, compose;
    • the landscape export and the two QUIC-Fire bundles (uniform surface; lookup surface plus topography).

Please review

  • completed_throwaway_inventory is shared and mutable. The modifications and treatments apply tests re-derive the same duplicate in turn. Each checks only its own ledger, so they pass in either order, but if the first one fails and leaves the inventory failed, the second fails too.
  • completed_topography_grid changes from 10 m with default bands to 30 m with explicit elevation, slope and aspect, so the landscape export can reuse it. Every test that reads it passes.
  • Two uploader runs remain. The point-cloud upload tests trigger the uploader through Eventarc when their file lands in the bucket, which the header can't prevent. This is tracked in Test-suite audit: suite structure (CI gating, isolation, leaks, offline unit tests) FastFuels-API-v2#648.

Verification

  • Header confirmed on prod: one create with the header stayed pending after 45 s.
  • One full pytest v2 run: 469 passed, 1 skipped (the existing NetCDF skip).
    • An uncommitted counting plugin logged each POST and PUT and whether it carried the header.
    • 45 header-free POSTs: 43 dispatches plus 2 upload creates.
    • 4 GCS upload PUTs, each of which starts the uploader.
    • 72 creates carried the header.
  • The ~105 "before" figure was counted by reading the old code, so that the suite didn't have to start 105 more prod jobs to measure it.
  • The v1 tests were not run.

Every v2 test request now sends X-FastFuels-Skip-Dispatch: 1, so create
tests store their resource without starting a prod worker job. Tests
that wait on a job or read its results request the real_dispatch
fixture, and fixtures that build completed resources create them inside
real_dispatch_client().

Refs #230
Session fixtures now provide one voxel grid (DUET, LeafLux, Fosberg and
QUIC-Fire), one topography grid on its lattice (Fosberg and QUIC-Fire),
one inventory CSV export and one 3DEP point cloud to every module. The
shared topography grid moves to 30 m so the landscape export reuses it,
LeafLux and Fosberg share one irradiance grid, and the two inventory
apply tests share one completed duplicate.

Refs #230
@amarcozzi amarcozzi added 🧪 testing You're not done until you write tests v2 FastFuels v2 API / SDK work labels Oct 13, 2026
@amarcozzi amarcozzi self-assigned this Oct 13, 2026
@amarcozzi
amarcozzi merged commit a51dccc into main Oct 13, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧪 testing You're not done until you write tests v2 FastFuels v2 API / SDK work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2 tests: skip worker dispatch for create-only tests and share completed fixtures

1 participant