From bc60f4771dd4bef7cce2e444c295c08036162c64 2021-01-16 22:40:22 From: Branko Majic Date: 2021-01-16 22:40:22 Subject: [PATCH] MAR-151: Test removal of backports pin for lua-ldap (for Stretch -> Buster upgrades). --- diff --git a/roles/xmpp_server/molecule/default/files/lua_ldap_backports_pin b/roles/xmpp_server/molecule/default/files/lua_ldap_backports_pin new file mode 100644 index 0000000000000000000000000000000000000000..b4a6225d422dec0f39930322222c13eb0e7545e9 --- /dev/null +++ b/roles/xmpp_server/molecule/default/files/lua_ldap_backports_pin @@ -0,0 +1,9 @@ +# +# This file contains pinning information for deploying the backported +# version of lud-ldap that supports Lua 5.2 (for use with the Prosody +# XMPP server). +# + +Package: lua-ldap +Pin: release a=buster-backports +Pin-Priority: 600 diff --git a/roles/xmpp_server/molecule/default/prepare.yml b/roles/xmpp_server/molecule/default/prepare.yml index 55225ac5666f9e9552b645b0510b88ac88137d12..f9487affda50e6c40543cf2df1befaf085015f9b 100644 --- a/roles/xmpp_server/molecule/default/prepare.yml +++ b/roles/xmpp_server/molecule/default/prepare.yml @@ -138,6 +138,14 @@ mode: 0644 state: present + - name: Deploy lua-ldap package pin for testing Stretch -> Buster upgrade scenario (no need to pin the package in Buster) + copy: + src: "lua_ldap_backports_pin" + dest: "/etc/apt/preferences.d/lua-ldap" + owner: root + group: root + mode: 0644 + - hosts: clients become: true tasks: diff --git a/roles/xmpp_server/molecule/default/tests/test_default_buster.py b/roles/xmpp_server/molecule/default/tests/test_default_buster.py new file mode 100644 index 0000000000000000000000000000000000000000..d9ddbd345bbfaf400f1de2c2748d52ddf4fd27ab --- /dev/null +++ b/roles/xmpp_server/molecule/default/tests/test_default_buster.py @@ -0,0 +1,20 @@ +import os + +import testinfra.utils.ansible_runner + + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-*-buster64') + + +def test_lua_ldap_pin_and_version(host): + """ + Tests if lua-ldap package is not pinned to the backports + repository. + """ + + pin_configuration_file = host.file("/etc/apt/preferences.d/lua-ldap") + lua_ldap = host.package("lua-ldap") + + assert not pin_configuration_file.exists + assert "bpo" not in lua_ldap.version diff --git a/roles/xmpp_server/tasks/main.yml b/roles/xmpp_server/tasks/main.yml index bd0c26a420fc952e47e9f04f2fa51a38e6697d51..25ac54d51cdca07a93782450fb5dc742875b221c 100644 --- a/roles/xmpp_server/tasks/main.yml +++ b/roles/xmpp_server/tasks/main.yml @@ -21,6 +21,12 @@ mode: 0644 when: "ansible_distribution_release == 'stretch'" +- name: Drop the Pin lua-ldap package (if machine was upgraded from Debian Stretch) + file: + path: "/etc/apt/preferences.d/lua-ldap" + state: absent + when: "ansible_distribution_release != 'stretch'" + - name: Add Prosody repository apt key apt_key: data: "{{ lookup('file', 'prosody-debian-packages.gpg') }}"