def METHOD_NAME(caplog, _instance):
    _instance._config.command_args = {"host": "invalid"}
    hosts = ["instance-1"]
    with pytest.raises(SystemExit) as e:
        _instance._get_hostname(hosts)
    assert e.value.code == 1
    msg = (
        "There are no hosts that match 'invalid'.  You "
        "can only login to valid hosts."
    )
    assert msg in caplog.text