diff --git a/ansible/roles/test/tasks/advanced-reboot.yml b/ansible/roles/test/tasks/advanced-reboot.yml index 847089449d6..e5199d39c06 100644 --- a/ansible/roles/test/tasks/advanced-reboot.yml +++ b/ansible/roles/test/tasks/advanced-reboot.yml @@ -154,6 +154,26 @@ - include: ptf_runner_reboot.yml with_items: "{{ preboot_list }}" + # When new image is defined, test removed /host/config_db.json + # before warm rebooting. So after the device boots up, it will + # miss /etc/sonic/config_db.json. It is not an issue for the + # device to stay up. But it will be an issue when device reboot + # again (cold or fast). + - name: Save configuration after warm rebooting into new image + shell: config save -y + become: yes + when: + - new_sonic_image is defined + - reboot_type == "warm-reboot" + + - name: check /etc/sonic/config_db.json existence + stat: + path: /etc/sonic/config_db.json + register: stat_result + + - fail: msg="/etc/sonic/config_db.json is missing" + when: not stat_result.stat.exists + always: - name: Remove existing ip from ptf host script: roles/test/files/helpers/remove_ip.sh