Skip to content

Commit

Permalink
Automate BZ 2250732 (#15049)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhellebr authored May 15, 2024
1 parent 31b25db commit bc57170
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/foreman/cli/test_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import pytest

from robottelo.config import settings
from robottelo.exceptions import CLIFactoryError


def assert_job_invocation_result(
Expand Down Expand Up @@ -334,6 +335,37 @@ def test_positive_run_concurrent_jobs(self, rex_contenthosts, target_sat):
target_sat.cli.GlobalParameter().delete({'name': param_name})
assert len(target_sat.cli.GlobalParameter().list({'search': param_name})) == 0

@pytest.mark.parametrize(
'value', [0, -2, 2.5, 'a'], ids=['zero', 'negative', 'decimal', 'string']
)
@pytest.mark.rhel_ver_list([8])
def test_negative_invalid_concurrency_level(self, rex_contenthost, target_sat, value):
"""Tests you can not invoke job with invalid concurrency level
:id: 15b55f91-759a-4b77-8ba2-330a5ca7ca0b
:steps:
1. Run a REX job with invalid concurrency-setting
:expectedresults: should refuse gracefully
:BZ: 2250732
:parametrized: yes
"""
with pytest.raises(CLIFactoryError) as error:
target_sat.cli_factory.job_invocation(
{
'job-template': 'Run Command - Ansible Default',
'inputs': 'command=ls',
'search-query': f'name ~ {rex_contenthost.hostname}',
'concurrency-level': f'{value}',
}
)
assert 'Concurrency level: must be greater than 0' in str(
error.value
) or 'Numeric value is required' in str(error.value)

@pytest.mark.rhel_ver_list([8])
def test_positive_run_serial(self, rex_contenthosts, target_sat):
"""Tests subtasks in a job run one by one when concurrency level set to 1
Expand Down

0 comments on commit bc57170

Please sign in to comment.