theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
146 stars 163 forks source link

repository test tries to update repo label #1164

Open pondrejk opened 3 years ago

pondrejk commented 3 years ago
SUMMARY

make livetest_repository fails with

AssertionError: ["The following parameters are not supported by your server when performing update on repositories: {'label'}. They were ignored."]

Probably test_playbooks/repository.yml tries to update repo label (by loading tasks/repository.yml?)

ISSUE TYPE
ANSIBLE VERSION
ansible-2.9.16-1.el7ae.noarch
COLLECTION VERSION
ansible-collection-redhat-satellite.noarch 0:2.0.1-1.el7sat                                                        
KATELLO/FOREMAN VERSION
Satellite 6.9 
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
Error Message

AssertionError: ["The following parameters are not supported by your server when performing update on repositories: {'label'}. They were ignored."]
assert [] == ['The followi...ere ignored.']
  Right contains one more item: "The following parameters are not supported by your server when performing update on repositories: {'label'}. They were ignored."
  Full diff:
    [
  +  ,
  -  'The following parameters are not supported by your server when performing '
  -  "update on repositories: {'label'}. They were ignored.",
    ]

Stacktrace

tmpdir = local('/tmp/pytest-of-jenkins/pytest-605/test_crud_repository_0')
module = 'repository', vcrmode = 'live'

    @pytest.mark.parametrize('module', TEST_PLAYBOOKS)
    def test_crud(tmpdir, module, vcrmode):
        if vcrmode == "live":
            run = run_playbook(module)
        else:
            record = vcrmode == "record"
            run = run_playbook_vcr(tmpdir, module, record=record)
        assert run.rc == 0

>       _assert_no_warnings(run)

tests/test_crud.py:94: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

run = <ansible_runner.runner.Runner object at 0x7f1b98c49c70>

    def _assert_no_warnings(run):
        for event in run.events:
            # check for play level warnings
            assert not event.get('event_data', {}).get('warning', False)

            # check for task level warnings
            event_warnings = [warning for warning in event.get('event_data', {}).get('res', {}).get('warnings', []) if warning not in IGNORED_WARNINGS]
>           assert [] == event_warnings, str(event_warnings)
E           AssertionError: ["The following parameters are not supported by your server when performing update on repositories: {'label'}. They were ignored."]
E           assert [] == ['The followi...ere ignored.']
E             Right contains one more item: "The following parameters are not supported by your server when performing update on repositories: {'label'}. They were ignored."
E             Full diff:
E               [
E             +  ,
E             -  'The following parameters are not supported by your server when performing '
E             -  "update on repositories: {'label'}. They were ignored.",
E               ]

tests/test_crud.py:133: AssertionError
evgeni commented 3 years ago

I can't reproduce this on Satellite 6.9.1:

% make livetest_repository
pytest -v 'tests/test_crud.py::test_crud[repository]' --vcrmode live 
======== test session starts ========
platform linux -- Python 3.9.4, pytest-6.1.2, py-1.9.0, pluggy-0.13.1 -- /home/evgeni/Devel/theforeman/foreman-ansible-modules/venv/bin/python
cachedir: .pytest_cache
rootdir: /home/evgeni/Devel/theforeman/foreman-ansible-modules
plugins: forked-1.3.0, xdist-2.1.0
collected 1 item                                                                                                                                                                                                                      

tests/test_crud.py::test_crud[repository] PASSED                            [100%]

=== 1 passed in 215.75s (0:03:35) ===