Skip to content

Mark slow tests to allow for quicker iteration - #655

Merged
ehelms merged 2 commits into
theforeman:masterfrom
ekohl:mark-slow-tests
Jul 15, 2026
Merged

Mark slow tests to allow for quicker iteration#655
ehelms merged 2 commits into
theforeman:masterfrom
ekohl:mark-slow-tests

Conversation

@ekohl

@ekohl ekohl commented Jul 14, 2026

Copy link
Copy Markdown
Member

Why are you introducing these changes? (Problem description, related links)

While working on #511 I wanted to quickly run tests again and again. The full service restart is slow and not really something I was interested in.

What are the changes introduced in this pull request?

You can now skip slow tests with:

pytest -k "not slow"

How to test this pull request

Steps to reproduce:

  • Watch CI and verify it still runs the slow tests
  • Manually run pytest to skip the slow tests

Checklist

  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)

Comment thread tests/target_lifecycle_test.py
@arvind4501

Copy link
Copy Markdown
Contributor

I wonder if these are the only tests which are slow, I was thinking if there is a more definative way to figure out slow tests and mark them accordingly? and seems like pytest has a way to figure that out https://docs.pytest.org/en/stable/how-to/usage.html#profiling-test-execution-duration

@ekohl
ekohl force-pushed the mark-slow-tests branch from aef5ad2 to b852635 Compare July 15, 2026 08:20
@ekohl

ekohl commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

We even have that enabled in our test playbook:

cmd: "python -m pytest --durations=10 -vv {{ pytest_args | default() }}"

@ekohl

ekohl commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Migration is probably #661, the other is failing on:

RUNNING HANDLER [iop_kafka : Restart kafka] ************************************
Error: : Task failed: Failed to connect to the host via ssh: ssh: connect to host 192.168.121.253 port 22: No route to host

I don't see how that could be caused by my changes.

@arvind4501

arvind4501 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I don't see how that could be caused by my changes.

It not i think, failure seems unrelated

@ehelms

ehelms commented Jul 15, 2026

Copy link
Copy Markdown
Member

A note in our developer documentation about our use of slow and when to apply it, or at least how to think about when and when not to apply it would be helpful.

@ekohl
ekohl force-pushed the mark-slow-tests branch from b852635 to d4c13f4 Compare July 15, 2026 14:28
@ekohl

ekohl commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

I added some documentation, but wasn't quite sure about how to describe when to use the marker. I'm not sure if we need to provide that context now.

@ehelms

ehelms commented Jul 15, 2026

Copy link
Copy Markdown
Member

I added some documentation, but wasn't quite sure about how to describe when to use the marker. I'm not sure if we need to provide that context now.

I was kinda hoping for that description. Ideally something like "tests longer than 1 minute can (or should) be marked as slow" for example.

I can see it both as being a good heuristic to have a "time" based component, but also a way for us to grab the list of slow tests for analysis sometime in the future.

This is not a hard requirement on my part, just thinking out loud.

@ekohl

ekohl commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Slow is always relative. I wanted to avoid that.

@ehelms

ehelms commented Jul 15, 2026

Copy link
Copy Markdown
Member

You'll need a rebase here to fix tests.

@ekohl
ekohl force-pushed the mark-slow-tests branch from d4c13f4 to 09e3edb Compare July 15, 2026 18:19
@ekohl

ekohl commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

I tried to be a bit more creative now in the docs. Also couldn't resist adding links to the section above it.

@ehelms
ehelms merged commit 441d4dc into theforeman:master Jul 15, 2026
27 of 29 checks passed
@ekohl
ekohl deleted the mark-slow-tests branch July 15, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants