From 28b1d098f6feb2052eb07ac24df9361fd5adaa25 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 12 Dec 2021 15:20:42 +0100 Subject: [PATCH] fix tests and remove devel package --- defaults/main.yml | 2 +- molecule/centos7/tests/test_default.py | 8 ++++++++ molecule/rocky8/tests/test_default.py | 8 ++++++++ templates/etc/cups/cupsd.conf.j2 | 4 ++-- vars/main.yml | 7 +++---- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c52672d..dc45c48 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,5 @@ --- -cups_version: 2.3.3op2 +cups_version: 2.4.0-1 # @var cups_packages_extra:description: > # Install dependencies or custom driver packages diff --git a/molecule/centos7/tests/test_default.py b/molecule/centos7/tests/test_default.py index d693112..fc93e1c 100644 --- a/molecule/centos7/tests/test_default.py +++ b/molecule/centos7/tests/test_default.py @@ -16,3 +16,11 @@ def test_cups_running_and_enabled(host): def test_cups_socket(host): # Verify the socket is listening for HTTP traffic assert host.socket("tcp://127.0.0.1:631").is_listening + + +def test_cups_conn_error(host): + code = int(host.run("curl -s -w '%{http_code}' http://127.0.0.1:631/ -o /dev/null").stdout) + body = host.run("curl -sX GET http://127.0.0.1:631/").stdout + + assert code == 200 + assert "OpenPrinting CUPS" in body diff --git a/molecule/rocky8/tests/test_default.py b/molecule/rocky8/tests/test_default.py index d693112..fc93e1c 100644 --- a/molecule/rocky8/tests/test_default.py +++ b/molecule/rocky8/tests/test_default.py @@ -16,3 +16,11 @@ def test_cups_running_and_enabled(host): def test_cups_socket(host): # Verify the socket is listening for HTTP traffic assert host.socket("tcp://127.0.0.1:631").is_listening + + +def test_cups_conn_error(host): + code = int(host.run("curl -s -w '%{http_code}' http://127.0.0.1:631/ -o /dev/null").stdout) + body = host.run("curl -sX GET http://127.0.0.1:631/").stdout + + assert code == 200 + assert "OpenPrinting CUPS" in body diff --git a/templates/etc/cups/cupsd.conf.j2 b/templates/etc/cups/cupsd.conf.j2 index 633b675..cc1927a 100644 --- a/templates/etc/cups/cupsd.conf.j2 +++ b/templates/etc/cups/cupsd.conf.j2 @@ -1,6 +1,6 @@ #jinja2: lstrip_blocks: True {{ ansible_managed | comment }} -# Configuration file for the CUPS scheduler. See "man cupsd.conf" for a +# Configuration file for the CUPS scheduler. See "man cupsd.conf" for a # complete description of this file. # @@ -14,7 +14,7 @@ DefaultEncryption Never LogLevel {{ cups_log_level | lower }} PageLogFormat -# Specifies the maximum size of the log files before they are rotated. The value "0" disables log rotation. +# Specifies the maximum size of the log files before they are rotated. The value "0" disables log rotation. MaxLogSize 1m # Default error policy for printers diff --git a/vars/main.yml b/vars/main.yml index 862041b..c8ff514 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,10 +1,9 @@ --- __cups_download_url: https://gitea.rknet.org/rpmbuild/cups/releases/download/v{{ cups_version }} __cups_packages: - - "{{ __cups_download_url }}/cups-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" - - "{{ __cups_download_url }}/cups-devel-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" - - "{{ __cups_download_url }}/cups-libs-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" - - "{{ __cups_download_url }}/cups-lpd-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" + - "{{ __cups_download_url }}/cups-{{ cups_version }}.el{{ ansible_distribution_major_version }}.x86_64.rpm" + - "{{ __cups_download_url }}/cups-libs-{{ cups_version }}.el{{ ansible_distribution_major_version }}.x86_64.rpm" + - "{{ __cups_download_url }}/cups-lpd-{{ cups_version }}.el{{ ansible_distribution_major_version }}.x86_64.rpm" __pam_config: - type: "auth"