Skip to content

Refactor many slow functional tests to be faster - #7968

Draft
gerrod3 wants to merge 28 commits into
pulp:mainfrom
gerrod3:faster-tests
Draft

Refactor many slow functional tests to be faster#7968
gerrod3 wants to merge 28 commits into
pulp:mainfrom
gerrod3:faster-tests

Conversation

@gerrod3

@gerrod3 gerrod3 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Most of it is just being smart in how we populate repos with content: create content first in parallel, then do modify.

https://redhat.atlassian.net/browse/PULP-2238

📜 Checklist

  • Commits are cleanly separated with meaningful messages (simple features and bug fixes should be squashed to one commit)
  • A changelog entry or entries has been added for any significant changes
  • Follows the Pulp policy on AI Usage
  • (For new features) - User documentation and test coverage has been added

See: Pull Request Walkthrough

@gerrod3

gerrod3 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

After comparing this to #7930, it seems the only thing that moved the needle was the test_repo_version_pagination and test_hidden_distros. 109s -> under 20; 27s -> under 20, respectively. Everything else had little effect.

Next I'm going to take a look and see if these tests should be marked parallel. There might be too many tests with many tasks causing congestion among the workers.

Results:

Test #7930 #7968 Notes
test_repo_version_pagination 109.2s Left top-20; main suite win
test_hidden_distros 26.8s 2+2 distros; left top-20
test_content_types 55.8s 55.5s Flat
test_checkpoint_retention 47.3s 48.6s Flat / noise
test_distribution_filtering 40.9s 45.0s Slightly slower this run
test_create_and_filter_with_prn 31.5s 32.6s Flat
test_repo_versions_protected_from_cleanup 26.3s 31.1s No win vs this PR baseline
test_auto_publish_and_distribution 20.5s 22.0s Flat under parallel load

@gerrod3

gerrod3 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Moving some parallel tests over to serial improved another ~30 secs or so. Still not happy that azure is close to 30 mins. Seems to be quite wild in its variance.

Area Before After
Checkpoint class setup 3× ~36s under ‖ 1× 7.7s serial
SyncedRepoExport setups 3× ~14–15s 1× 3.4s
pulpcore ‖ suite 363s 310s (−54s)
pulpcore serial 148s 173s (+25s, expected)
pulp_file ‖ / serial 205 / 23s 190 / 39s
Net 4 suites ~−27s

@dralley
dralley marked this pull request as draft August 14, 2026 03:09
@gerrod3

gerrod3 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

After-parallel task-queue-stats from CI run 31764714280 (5438115b3):

Worker wait (started_at − unblocked_at) after ‖ suites

Matrix n mean p90 p99 max
pulp 950 50ms 80ms 262ms 471ms
s3 1000 40ms 53ms 85ms 2.5s*
lowerbounds 950 37ms 49ms 84ms 143ms
azure (redis) n/a (no unblocked_at)

*s3 max is a single synchronize outlier; p99 is still 85ms.

Verdict: worker starvation is not the bottleneck. With 4 workers and -n 8, unblocked tasks almost never wait. Occasional resource waits hit ~2–3s. Slow parallel tests are mostly runtime (and some lock contention), not queued behind busy workers — bumping PULP_WORKERS is unlikely to help much.

gerrod3 and others added 23 commits August 14, 2026 11:28
The functional test waits on the worker heartbeat cleanup interval, so
keep it long_running for e2e/nightly and cover the cleanup path with a
fast unit test for routine CI.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Use a smaller page size so fewer versions are needed, and create content
units before modifying the repository so create tasks can overlap.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Pre-create content units so create tasks can overlap before the serial
modify and publish steps that assert distributed versions are retained.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Dispatch content create tasks before monitoring so they can overlap,
instead of creating each unit serially through the factory.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Pre-create content so create tasks can overlap, and wait for distinct
checkpoint timestamps only when wall-clock has not already advanced a
second instead of always sleeping for a full second.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace two 3-file fixture syncs with overlapping content creates and
repository modifies, which is enough for the with_content filter checks.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Use on_demand sync so the test still covers PRNs without downloading
fixture artifacts.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Dispatch content creates concurrently and stop attaching each unit to a
bucket repository, cutting setup time for several repo-version tests.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Create two visible and two hidden distributions instead of five each;
that still covers index visibility without ten serial create tasks.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the immediate fixture sync with overlapping content creates and
repository modifies; the test only needs two versions and PULP_MANIFEST
checks.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the three-file fixture sync with a single content create attached
to the repository; keep a remote only for the mirror=True rejection.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Class-scoped setup builds five publications; under xdist each parallel
test rebuilt it. The HTTP assertions are far cheaper than that setup.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Group consumers of import_export_repositories into a serial class with
class-scoped fixtures so the two immediate syncs run once. Keep light
import-check tests and self-contained cases parallel.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Use a serial class with class-scoped three-repo sync and exporter fixtures
so xdist does not redo the expensive setup for each export consumer.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Expose started_at - unblocked_at summaries via pulpcore-manager and print
them after CI functional tests to spot worker congestion.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Move task-queue-stats out of post_script so it runs before serial/cli
and task purge can erase the parallel-phase congestion signal.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Use ContentFilesApi.upload instead of task-backed creates, and fetch
all Content-Type headers concurrently on a shared aiohttp session.

Assisted-By: Cursor Grok 4.5
Co-authored-by: Cursor <cursoragent@cursor.com>
Replace task-backed ContentFilesApi.create in the remaining overlapping
content-create tests so units appear without monitor_task.

Assisted-By: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep two checkpoints and retain_checkpoints=1, and skip creating an
unused distribution.

Assisted-By: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
gerrod3 and others added 5 commits August 14, 2026 11:28
The functional test slept 60s and queued 25 tasks. Cover
FETCH_TASK_LIMIT doubling in fetch_task without a live worker.

Assisted-By: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Fetch all rewritten list URLs concurrently with limit=1 instead of
serial full-page GETs.

Assisted-By: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Populate upstreams with one uploaded file instead of 3-file fixture
syncs, and use fewer distributions where label/policy coverage remains.

Assisted-By: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Skip unused same-domain syncs and successful exports; keep one uploaded
file where a version or last_export is needed for the 400 cases.

Assisted-By: Cursor Grok 4.6
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant