summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_ha/tests/cli/replaced.yaml
blob: d35f3345d39bca19c866b3a041e7bf15d9dd26a8 (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
---
- debug:
    msg: START vyos_ha replaced integration tests on connection={{ ansible_connection }}

- include_tasks: _remove_config.yaml

- include_tasks: _populate_config.yaml

- block:
    - name: Replace the provided configuration with the existing running configuration
      register: result
      vyos.vyos.vyos_ha: &id001
        config: "{{ merged.config }}"
        state: replaced

    - vyos.vyos.vyos_facts:
        gather_network_resources: ha

    - assert:
        that:
          - result.changed == true
          - result.commands | symmetric_difference(replaced.commands) == []
          - "result.after == ansible_facts['network_resources']['ha']"

    - name: Replace the provided configuration with the existing running configuration (IDEMPOTENT)
      register: result
      vyos.vyos.vyos_ha: *id001

    - name: Assert that the previous task was idempotent
      assert:
        that:
          - result['changed'] == false
          - result['commands'] == []
          - "result['before'] == ansible_facts['network_resources']['ha']"

  always:
    - include_tasks: _remove_config.yaml