summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/dnf/tasks/filters.yml
blob: 1ce9b6687f740cd03108784a7f9d4c5393126a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# We have a test repo set up with a valid updateinfo.xml which is referenced
# from its repomd.xml.
- block:
    - set_fact:
        updateinfo_repo: https://ci-files.testing.ansible.com/test/integration/targets/setup_rpm_repo/repo-with-updateinfo

    - name: Install the test repo
      yum_repository:
        name: test-repo-with-updateinfo
        description: test-repo-with-updateinfo
        baseurl: "{{ updateinfo_repo }}"
        gpgcheck: no

    - name: Install old versions of toaster and oven
      dnf:
        name:
          - "{{ updateinfo_repo }}/toaster-1.2.3.4-1.el8.noarch.rpm"
          - "{{ updateinfo_repo }}/oven-1.2.3.4-1.el8.noarch.rpm"
        disable_gpg_check: true

    - name: Ask for pending updates
      dnf:
        name: '*'
        state: latest
        update_only: true
        disable_gpg_check: true
        disablerepo: '*'
        enablerepo: test-repo-with-updateinfo
      register: update_no_filter

    - assert:
        that:
          - update_no_filter is changed
          - '"Installed: toaster-1.2.3.5-1.el8.noarch" in update_no_filter.results'
          - '"Installed: oven-1.2.3.5-1.el8.noarch" in update_no_filter.results'
          - '"Removed: toaster-1.2.3.4-1.el8.noarch" in update_no_filter.results'
          - '"Removed: oven-1.2.3.4-1.el8.noarch" in update_no_filter.results'

    - name: Install old versions of toaster and oven
      dnf:
        name:
          - "{{ updateinfo_repo }}/toaster-1.2.3.4-1.el8.noarch.rpm"
          - "{{ updateinfo_repo }}/oven-1.2.3.4-1.el8.noarch.rpm"
        allow_downgrade: true
        disable_gpg_check: true

    - name: Ask for pending updates with security=true
      dnf:
        name: '*'
        state: latest
        update_only: true
        disable_gpg_check: true
        security: true
        disablerepo: '*'
        enablerepo: test-repo-with-updateinfo
      register: update_security

    - assert:
        that:
          - update_security is changed
          - '"Installed: toaster-1.2.3.5-1.el8.noarch" in update_security.results'
          - '"Removed: toaster-1.2.3.4-1.el8.noarch" in update_security.results'
          - '"Installed: oven-1.2.3.5-1.el8.noarch" not in update_security.results'
          - '"Removed: oven-1.2.3.4-1.el8.noarch" not in update_security.results'

    - name: Install old versions of toaster and oven
      dnf:
        name:
          - "{{ updateinfo_repo }}/toaster-1.2.3.4-1.el8.noarch.rpm"
          - "{{ updateinfo_repo }}/oven-1.2.3.4-1.el8.noarch.rpm"
        allow_downgrade: true
        disable_gpg_check: true

    - name: Ask for pending updates with bugfix=true
      dnf:
        name: '*'
        state: latest
        update_only: true
        disable_gpg_check: true
        bugfix: true
        disablerepo: '*'
        enablerepo: test-repo-with-updateinfo
      register: update_bugfix

    - assert:
        that:
          - update_bugfix is changed
          - '"Installed: toaster-1.2.3.5-1.el8.noarch" not in update_bugfix.results'
          - '"Removed: toaster-1.2.3.4-1.el8.noarch" not in update_bugfix.results'
          - '"Installed: oven-1.2.3.5-1.el8.noarch" in update_bugfix.results'
          - '"Removed: oven-1.2.3.4-1.el8.noarch" in update_bugfix.results'

    - name: Install old versions of toaster and oven
      dnf:
        name:
          - "{{ updateinfo_repo }}/toaster-1.2.3.4-1.el8.noarch.rpm"
          - "{{ updateinfo_repo }}/oven-1.2.3.4-1.el8.noarch.rpm"
        allow_downgrade: true
        disable_gpg_check: true

    - name: Verify toaster is not upgraded with state=installed
      dnf:
        name: "{{ item }}"
        state: installed
      register: installed
      loop:
        - toaster
        - toaster.noarch
        - toaster-1.2.3.4-1.el8.noarch

    - assert:
        that: "installed.results | map(attribute='changed') is not any"

    - name: Ask for pending updates with bugfix=true and security=true
      dnf:
        name: '*'
        state: latest
        update_only: true
        disable_gpg_check: true
        bugfix: true
        security: true
        disablerepo: '*'
        enablerepo: test-repo-with-updateinfo
      register: update_bugfix

    - assert:
        that:
          - update_bugfix is changed
          - '"Installed: toaster-1.2.3.5-1.el8.noarch" in update_bugfix.results'
          - '"Removed: toaster-1.2.3.4-1.el8.noarch" in update_bugfix.results'
          - '"Installed: oven-1.2.3.5-1.el8.noarch" in update_bugfix.results'
          - '"Removed: oven-1.2.3.4-1.el8.noarch" in update_bugfix.results'

    - name: Install old version of toaster again
      dnf:
        name: "{{ updateinfo_repo }}/toaster-1.2.3.4-1.el8.noarch.rpm"
        allow_downgrade: true
        disable_gpg_check: true

    - name: Verify toaster is upgraded with state=latest
      dnf:
        name: toaster.noarch
        state: latest
      register: result

    - assert:
        that: result.changed

  always:
    - name: Remove installed packages
      dnf:
        name:
          - toaster
          - oven
        state: absent

    - name: Remove the repo
      yum_repository:
        name: test-repo-with-updateinfo
        state: absent
  tags:
    - filters