summaryrefslogtreecommitdiff
path: root/test/integration/targets/ucs_ntp_server
diff options
context:
space:
mode:
authorJohn McDonough <movinalot@gmail.com>2018-07-19 05:32:26 -0400
committerDag Wieers <dag@wieers.com>2018-07-19 11:32:26 +0200
commitf89d3721b4742e83acfa401cad77ce5e8d18b374 (patch)
tree79f0f03d1447cffb7098e2a7d025f4c0027ae886 /test/integration/targets/ucs_ntp_server
parentc527af58f18776ca5b064ac09b1c7185e4c89d0b (diff)
downloadansible-f89d3721b4742e83acfa401cad77ce5e8d18b374.tar.gz
UCS NTP Server module (#42375)
* UCS NTP Server module initial commit * change name to ntp_server, keep name as alias for ntp_server
Diffstat (limited to 'test/integration/targets/ucs_ntp_server')
-rw-r--r--test/integration/targets/ucs_ntp_server/aliases7
-rw-r--r--test/integration/targets/ucs_ntp_server/tasks/main.yml110
2 files changed, 117 insertions, 0 deletions
diff --git a/test/integration/targets/ucs_ntp_server/aliases b/test/integration/targets/ucs_ntp_server/aliases
new file mode 100644
index 0000000000..16a714d47a
--- /dev/null
+++ b/test/integration/targets/ucs_ntp_server/aliases
@@ -0,0 +1,7 @@
+# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware.
+# Example integration_config.yml:
+# ---
+# ucs_hostname: 172.22.251.170
+# ucs_username: admin
+# ucs_password: password
+unsupported \ No newline at end of file
diff --git a/test/integration/targets/ucs_ntp_server/tasks/main.yml b/test/integration/targets/ucs_ntp_server/tasks/main.yml
new file mode 100644
index 0000000000..8e75fc82eb
--- /dev/null
+++ b/test/integration/targets/ucs_ntp_server/tasks/main.yml
@@ -0,0 +1,110 @@
+# Test code for the UCS modules
+# Copyright 2018, John McDonough (@movinalot)
+
+- name: Test that we have a UCS host, UCS username, and UCS password
+ fail:
+ msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
+ when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
+ vars:
+ login_info: &login_info
+ hostname: "{{ ucs_hostname }}"
+ username: "{{ ucs_username }}"
+ password: "{{ ucs_password }}"
+
+# Setup (clean environment)
+- name: NTP Server absent
+ ucs_ntp_server: &ntp_server_absent
+ <<: *login_info
+ ntp_server: pool.ntp.org
+ state: absent
+
+# Test present (check_mode)
+- name: NTP Server present (check_mode)
+ ucs_ntp_server: &ntp_server_present
+ <<: *login_info
+ ntp_server: pool.ntp.org
+ check_mode: yes
+ register: cm_ntp_server_present
+
+# Present (normal mode)
+- name: NTP Server present (normal mode)
+ ucs_ntp_server: *ntp_server_present
+ register: nm_ntp_server_present
+
+# Test present again (idempotent)
+- name: NTP Server present again (check_mode)
+ ucs_ntp_server: *ntp_server_present
+ check_mode: yes
+ register: cm_ntp_server_present_again
+
+# Present again (normal mode)
+- name: NTP Server present again (normal mode)
+ ucs_ntp_server: *ntp_server_present
+ register: nm_ntp_server_present_again
+
+# Verfiy present
+- name: Verify NTP Server present results
+ assert:
+ that:
+ - cm_ntp_server_present.changed == nm_ntp_server_present.changed == true
+ - cm_ntp_server_present_again.changed == nm_ntp_server_present_again.changed == false
+
+# Test change (check_mode)
+- name: NTP NTP Server change (check_mode)
+ ucs_ntp_server: &ntp_server_change
+ <<: *ntp_server_present
+ ntp_server: 10.10.10.10
+ check_mode: yes
+ register: cm_ntp_ntp_server_change
+
+# Change (normal mode)
+- name: NTP NTP Server change (normal mode)
+ ucs_ntp_server: *ntp_server_change
+ register: nm_ntp_ntp_server_change
+
+# Test change again (idempotent)
+- name: NTP NTP Server change again (check_mode)
+ ucs_ntp_server: *ntp_server_change
+ check_mode: yes
+ register: cm_ntp_ntp_server_change_again
+
+# Change again (normal mode)
+- name: NTP NTP Server change again (normal mode)
+ ucs_ntp_server: *ntp_server_change
+ register: nm_ntp_ntp_server_change_again
+
+# Verfiy change
+- name: Verify NTP NTP Server change results
+ assert:
+ that:
+ - cm_ntp_ntp_server_change.changed == nm_ntp_ntp_server_change.changed == true
+ - cm_ntp_ntp_server_change_again.changed == nm_ntp_ntp_server_change_again.changed == false
+
+# Teardown (clean environment)
+- name: NTP Server absent (check_mode)
+ ucs_ntp_server: *ntp_server_absent
+ check_mode: yes
+ register: cm_ntp_server_absent
+
+# Absent (normal mode)
+- name: NTP Server absent (normal mode)
+ ucs_ntp_server: *ntp_server_absent
+ register: nm_ntp_server_absent
+
+# Test absent again (idempotent)
+- name: NTP Server absent again (check_mode)
+ ucs_ntp_server: *ntp_server_absent
+ check_mode: yes
+ register: cm_ntp_server_absent_again
+
+# Absent again (normal mode)
+- name: NTP Server absent again (normal mode)
+ ucs_ntp_server: *ntp_server_absent
+ register: nm_ntp_server_absent_again
+
+# Verfiy absent
+- name: Verify NTP Server absent results
+ assert:
+ that:
+ - cm_ntp_server_absent.changed == nm_ntp_server_absent.changed == true
+ - cm_ntp_server_absent_again.changed == nm_ntp_server_absent_again.changed == false