Skip to content
This repository has been archived by the owner on Mar 23, 2019. It is now read-only.

Enable validate-config tests and add a new test #883

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

Enable validate-config tests and add a new test #883

wants to merge 7 commits into from

Conversation

pilou-
Copy link
Contributor

@pilou- pilou- commented Feb 8, 2018

ISSUE TYPE
  • Bugfix Pull Request
SUMMARY

validate-config tests:

  • enable existing tests
  • add a new test

Depends-On: #882

@pilou-
Copy link
Contributor Author

pilou- commented Mar 12, 2018

Pull request rebased (conflict fixed)

Error message:
______ TestAnsibleContainerConfig.test_should_also_replace_pwd_in_volumes ______

self = <validate_config.TestAnsibleContainerConfig testMethod=test_should_also_replace_pwd_in_volumes>

    def test_should_also_replace_pwd_in_volumes(self):
        # test that ${PWD} gets resolved
        self.config.cli_vars_files = self.vars_files
        self.config.set_env('prod')
        container.ENV = 'conductor'
        container.utils.DataLoader = DataLoader
        container.utils.VariableManager = VariableManager
        container.utils.RoleInclude = RoleInclude
>       conductor_config = AnsibleContainerConductorConfig(self.config._config)

ansible-container/test/tests/validate_config.py:145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ansible-container/container/__init__.py:19: in __wrapped__
    return fn(*args, **kwargs)
ansible-container/container/config.py:357: in __init__
    self._process_defaults()
ansible-container/container/config.py:390: in _process_defaults
    callback=lambda processed: self._templar.set_available_variables(
ansible-container/container/config.py:375: in _process_section
    yaml.round_trip_dump(value, buffer)
[...]
venv/3.6/lib/python3.6/site-packages/ruamel/yaml/emitter.py:422: in expect_flow_sequence
    self.write_indicator(u' ' * ind + u'[', True, whitespace=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <ruamel.yaml.dumper.RoundTripDumper object at 0x7fbda6e59e48>
indicator = '[', need_whitespace = True, whitespace = True, indention = False

    def write_indicator(self, indicator, need_whitespace,
                        whitespace=False, indention=False):
        # type: (Any, Any, bool, bool) -> None
        if self.whitespace or not need_whitespace:
            data = indicator
        else:
            data = u' ' + indicator
        self.whitespace = whitespace
        self.indention = self.indention and indention
        self.column += len(data)
        self.open_ended = False
        if bool(self.encoding):
            data = data.encode(self.encoding)
>       self.stream.write(data)
E       TypeError: a bytes-like object is required, not 'str'

venv/3.6/lib/python3.6/site-packages/ruamel/yaml/emitter.py:1059: TypeError
@pilou-
Copy link
Contributor Author

pilou- commented Jun 20, 2018

@Voronenko could you review this one ?

Extract from build log (17 passed in 1.91 seconds):

TASK [validate-config : Cat output] ********************************************
�[1;30mtask path: /home/travis/build/ansible/ansible-container/test/includes/show-output.yml:3�[0m
�[0;34mUsing module file /home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/ansible/modules/commands/command.py�[0m
[...]
�[0;33mchanged: [localhost] => {�[0m
�[0;33m    "changed": true, �[0m
�[0;33m    "cmd": [�[0m
�[0;33m        "cat", �[0m
�[0;33m        "./task.output"�[0m
�[0;33m    ], �[0m
�[0;33m    "delta": "0:00:00.004054", �[0m
�[0;33m    "end": "2018-06-20 08:12:02.068743", �[0m
�[0;33m    "invocation": {�[0m
�[0;33m        "module_args": {�[0m
�[0;33m            "_raw_params": "cat \"./task.output\"", �[0m
�[0;33m            "_uses_shell": false, �[0m
�[0;33m            "chdir": null, �[0m
�[0;33m            "creates": null, �[0m
�[0;33m            "executable": null, �[0m
�[0;33m            "removes": null, �[0m
�[0;33m            "stdin": null, �[0m
�[0;33m            "warn": true�[0m
�[0;33m        }�[0m
�[0;33m    }, �[0m
�[0;33m    "rc": 0, �[0m
�[0;33m    "start": "2018-06-20 08:12:02.064689", �[0m
�[0;33m    "stderr": "", �[0m
�[0;33m    "stderr_lines": [], �[0m
�[0;33m    "stdout": "============================= test session starts ==============================\nplatform linux2 -- Python 2.7.13, pytest-3.2.1, py-1.4.34, pluggy-0.4.0\nrootdir: /home/travis/build/ansible/ansible-container, inifile:\ncollected 17 items\n\n../../test/tests/validate_config.py .................\n\n========================== 17 passed in 1.91 seconds ===========================", �[0m
�[0;33m    "stdout_lines": [�[0m
�[0;33m        "============================= test session starts ==============================", �[0m
�[0;33m        "platform linux2 -- Python 2.7.13, pytest-3.2.1, py-1.4.34, pluggy-0.4.0", �[0m
�[0;33m        "rootdir: /home/travis/build/ansible/ansible-container, inifile:", �[0m
�[0;33m        "collected 17 items", �[0m
�[0;33m        "", �[0m
�[0;33m        "../../test/tests/validate_config.py .................", �[0m
�[0;33m        "", �[0m
�[0;33m        "========================== 17 passed in 1.91 seconds ==========================="�[0m
�[0;33m    ]�[0m

@Voronenko
Copy link
Contributor

@pilou- What issue no PR refers to, if any ?

@pilou-
Copy link
Contributor Author

pilou- commented Jun 20, 2018

@Voronenko this pull-request:

  • fix and enable existing validate-config tests
  • add a new unit test: test_get_dependencies_for_role

@pilou-
Copy link
Contributor Author

pilou- commented Jun 20, 2018

@gregdek could you merge this one ?

@gregdek gregdek requested a review from Voronenko June 20, 2018 17:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants