Changeset - 693d6960b1a0
[Not reviewed]
0 2 0
Branko Majic (branko) - 6 years ago 2020-01-06 16:54:36
branko@majic.rs
MAR-148: Fix test for the common role:

- Do some additional stripping on command outputs to get rid of extra
new lines.
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
roles/common/molecule/default/tests/test_default.py
Show inline comments
 
@@ -330,13 +330,13 @@ def test_pipreqcheck_virtualenv_packages(host, pip_path, expected_packages):
 
    """
 

	
 
    packages = host.run("sudo -u %s %s freeze --all" % ('pipreqcheck', pip_path))
 

	
 
    # Normalise package names and order.
 
    expected_packages = sorted([unicode(p.lower()) for p in expected_packages])
 
    actual_packages = sorted(packages.stdout.lower().split("\n"))
 
    actual_packages = sorted(packages.stdout.lower().strip().split("\n"))
 

	
 
    # This is a dummy distro-provided package ignored by the pip-tools.
 
    if "pkg-resources==0.0.0" in actual_packages:
 
        actual_packages.remove("pkg-resources==0.0.0")
 

	
 
    assert actual_packages == expected_packages
 
@@ -386,13 +386,13 @@ def test_pipreqcheck_virtualenv_python_version(host, python_path, expected_major
 
    """
 

	
 
    with host.sudo('pipreqcheck'):
 
        major_version = host.run("%s -c %s", python_path, "import sys; print(sys.version_info.major)")
 

	
 
    assert major_version.rc == 0
 
    assert major_version.stdout == expected_major_version
 
    assert major_version.stdout.strip() == expected_major_version
 

	
 

	
 
@pytest.mark.parametrize('wrong_python_path', [
 
    '/var/lib/pipreqcheck/virtualenv/bin/python3',
 
    '/var/lib/pipreqcheck/virtualenv-py3/bin/python2',
 
])
roles/common/molecule/default/tests/test_parameters_optional.py
Show inline comments
 
@@ -344,13 +344,13 @@ def test_ntp_query_server_count(host):
 
    # Two lines for headers, and one line per configured server.
 
    expected_stdout_line_count = 5
 

	
 
    ntpq = host.command("ntpq -p -n")
 

	
 
    assert ntpq.rc == 0
 
    assert len(ntpq.stdout.split("\n")) == expected_stdout_line_count
 
    assert len(ntpq.stdout.strip().split("\n")) == expected_stdout_line_count
 

	
 

	
 
def test_ntp_listening_interfaces(host):
 
    """
 
    Tests if NTP server is listening on correct ports.
 
    """
0 comments (0 inline, 0 general)