Ensure timezone tests reset system timezone to original value (#39326)
This commit is contained in:
parent
dd735b2122
commit
fda67bae50
1 changed files with 17 additions and 11 deletions
|
@ -1,15 +1,21 @@
|
||||||
- name: set timezone to Etc/UTC
|
- name: Set timezone to Etc/UTC
|
||||||
timezone:
|
timezone:
|
||||||
name: Etc/UTC
|
name: Etc/UTC
|
||||||
|
register: original_timezone
|
||||||
|
|
||||||
- name: set timezone to Australia/Brisbane
|
- block:
|
||||||
timezone:
|
- name: Set timezone to Australia/Brisbane
|
||||||
name: Australia/Brisbane
|
timezone:
|
||||||
register: timezone_set
|
name: Australia/Brisbane
|
||||||
|
register: timezone_set
|
||||||
|
|
||||||
- name: ensure timezone changed
|
- name: Ensure timezone changed
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- timezone_set.changed
|
- timezone_set is changed
|
||||||
- timezone_set.diff.after.name == 'Australia/Brisbane'
|
- timezone_set.diff.after.name == 'Australia/Brisbane'
|
||||||
- timezone_set.diff.before.name == 'Etc/UTC'
|
- timezone_set.diff.before.name == 'Etc/UTC'
|
||||||
|
always:
|
||||||
|
- name: Restore original system timezone - {{ original_timezone.diff.before.name }}
|
||||||
|
timezone:
|
||||||
|
name: "{{ original_timezone.diff.before.name }}"
|
||||||
|
|
Loading…
Reference in a new issue