Skip to content

Introduce --test-target to more explicitly declare where tests run - #715

Draft
evgeni wants to merge 1 commit into
masterfrom
test-target
Draft

Introduce --test-target to more explicitly declare where tests run#715
evgeni wants to merge 1 commit into
masterfrom
test-target

Conversation

@evgeni

@evgeni evgeni commented Jul 31, 2026

Copy link
Copy Markdown
Member

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

Using --server-hostname always felt wrong, as we're not actually changing the hostname of the (Foreman) server, just the system we're running the tests against.

What are the changes introduced in this pull request?

  • Introduce --test-target which now declares what the server fixture points at
  • The old --server-hostname remains if we ever need to change the server name
  • Tests still use the server fixture, refactoring this is left for later

How to test this pull request

Steps to reproduce:

Checklist

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

This does not (yet) change the `server` fixture
@evgeni

evgeni commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

👀 @jeremylenz

Comment thread tests/conftest.py
def server(server_hostname):
yield get_paramiko_host(server_hostname)
def server(test_target):
yield get_paramiko_host(test_target)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this in place, it'd be a small change to also support --test-target=localhost for testing deploy-dev setups — just branch on the hostname in get_paramiko_host:

def get_paramiko_host(hostname):
    if hostname == 'localhost':
        return testinfra.get_host('local://', sudo=True)
    return testinfra.get_host(f'paramiko://{hostname}', sudo=True, ssh_config=SSH_CONFIG)

Since deploy-dev already supports --target-host=localhost, this would make the test side consistent with it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, if that works that sounds like a good addition

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.

2 participants