diff --git a/test/integration/cloudstack.yml b/test/integration/cloudstack.yml index 3ad4ed08349..bc275ad3bbd 100644 --- a/test/integration/cloudstack.yml +++ b/test/integration/cloudstack.yml @@ -23,3 +23,5 @@ - { role: test_cs_firewall, tags: test_cs_firewall } - { role: test_cs_loadbalancer_rule, tags: test_cs_loadbalancer_rule } - { role: test_cs_volume, tags: test_cs_volume } + - { role: test_cs_configuration, tags: test_cs_configuration } + diff --git a/test/integration/roles/test_cs_configuration/defaults/main.yml b/test/integration/roles/test_cs_configuration/defaults/main.yml new file mode 100644 index 00000000000..2c68b5099aa --- /dev/null +++ b/test/integration/roles/test_cs_configuration/defaults/main.yml @@ -0,0 +1,5 @@ +--- +test_cs_configuration_storage: PS0 +test_cs_configuration_cluster: C0 +test_cs_configuration_account: admin +test_cs_configuration_zone: Sandbox-simulator diff --git a/test/integration/roles/test_cs_configuration/meta/main.yml b/test/integration/roles/test_cs_configuration/meta/main.yml new file mode 100644 index 00000000000..03e38bd4f7a --- /dev/null +++ b/test/integration/roles/test_cs_configuration/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - test_cs_common diff --git a/test/integration/roles/test_cs_configuration/tasks/account.yml b/test/integration/roles/test_cs_configuration/tasks/account.yml new file mode 100644 index 00000000000..853fbf81a3a --- /dev/null +++ b/test/integration/roles/test_cs_configuration/tasks/account.yml @@ -0,0 +1,59 @@ +--- +- name: test configuration account + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: true + register: config +- name: verify test configuration storage + assert: + that: + - config|success + +- name: test update configuration account + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: false + register: config +- name: verify update configuration account + assert: + that: + - config|success + - config|changed + - config.value == "false" + - config.name == "allow.public.user.templates" + - config.scope == "account" + - config.account == "{{ test_cs_configuration_account }}" + +- name: test update configuration account idempotence + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: false + register: config +- name: verify update configuration account idempotence + assert: + that: + - config|success + - not config|changed + - config.value == "false" + - config.name == "allow.public.user.templates" + - config.scope == "account" + - config.account == "{{ test_cs_configuration_account }}" + +- name: test reset configuration account + cs_configuration: + name: allow.public.user.templates + account: "{{ test_cs_configuration_account }}" + value: true + register: config +- name: verify update configuration account + assert: + that: + - config|success + - config|changed + - config.value == "true" + - config.name == "allow.public.user.templates" + - config.scope == "account" + - config.account == "{{ test_cs_configuration_account }}" diff --git a/test/integration/roles/test_cs_configuration/tasks/cluster.yml b/test/integration/roles/test_cs_configuration/tasks/cluster.yml new file mode 100644 index 00000000000..c3328e41d8f --- /dev/null +++ b/test/integration/roles/test_cs_configuration/tasks/cluster.yml @@ -0,0 +1,59 @@ +--- +- name: test configuration cluster + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 1.0 + register: config +- name: verify test configuration cluster + assert: + that: + - config|success + +- name: test update configuration cluster + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 2.0 + register: config +- name: verify update configuration cluster + assert: + that: + - config|success + - config|changed + - config.value == "2.0" + - config.name == "cpu.overprovisioning.factor" + - config.scope == "cluster" + - config.cluster == "{{ test_cs_configuration_cluster }}" + +- name: test update configuration cluster idempotence + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 2.0 + register: config +- name: verify update configuration cluster idempotence + assert: + that: + - config|success + - not config|changed + - config.value == "2.0" + - config.name == "cpu.overprovisioning.factor" + - config.scope == "cluster" + - config.cluster == "{{ test_cs_configuration_cluster }}" + +- name: test reset configuration cluster + cs_configuration: + name: cpu.overprovisioning.factor + cluster: "{{ test_cs_configuration_cluster }}" + value: 1.0 + register: config +- name: verify reset configuration cluster + assert: + that: + - config|success + - config|changed + - config.value == "1.0" + - config.name == "cpu.overprovisioning.factor" + - config.scope == "cluster" + - config.cluster == "{{ test_cs_configuration_cluster }}" diff --git a/test/integration/roles/test_cs_configuration/tasks/main.yml b/test/integration/roles/test_cs_configuration/tasks/main.yml new file mode 100644 index 00000000000..5fdba116809 --- /dev/null +++ b/test/integration/roles/test_cs_configuration/tasks/main.yml @@ -0,0 +1,162 @@ +--- +- name: test fail if missing name + cs_configuration: + register: config + ignore_errors: true +- name: verify results of fail if missing arguments + assert: + that: + - config|failed + - "config.msg == 'missing required arguments: value,name'" + +- name: test configuration + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: global + register: config +- name: verify test configuration + assert: + that: + - config|success + +- name: test update configuration string + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: all + register: config +- name: verify test update configuration string + assert: + that: + - config|success + - config|changed + - config.value == "all" + - config.name == "network.loadbalancer.haproxy.stats.visibility" + +- name: test update configuration string idempotence + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: all + register: config +- name: verify test update configuration string idempotence + assert: + that: + - config|success + - not config|changed + - config.value == "all" + - config.name == "network.loadbalancer.haproxy.stats.visibility" + +- name: test reset configuration string + cs_configuration: + name: network.loadbalancer.haproxy.stats.visibility + value: global + register: config +- name: verify test reset configuration string + assert: + that: + - config|success + - config|changed + - config.value == "global" + - config.name == "network.loadbalancer.haproxy.stats.visibility" + +- name: test configuration + cs_configuration: + name: vmware.recycle.hung.wokervm + value: false + register: config +- name: verify test configuration + assert: + that: + - config|success + +- name: test update configuration bool + cs_configuration: + name: vmware.recycle.hung.wokervm + value: true + register: config +- name: verify test update configuration bool + assert: + that: + - config|success + - config|changed + - config.value == "true" + - config.name == "vmware.recycle.hung.wokervm" + +- name: test update configuration bool idempotence + cs_configuration: + name: vmware.recycle.hung.wokervm + value: true + register: config +- name: verify test update configuration bool idempotence + assert: + that: + - config|success + - not config|changed + - config.value == "true" + - config.name == "vmware.recycle.hung.wokervm" + +- name: test reset configuration bool + cs_configuration: + name: vmware.recycle.hung.wokervm + value: false + register: config +- name: verify test reset configuration bool + assert: + that: + - config|success + - config|changed + - config.value == "false" + - config.name == "vmware.recycle.hung.wokervm" + +- name: test configuration + cs_configuration: + name: agent.load.threshold + value: 0.7 + register: config +- name: verify test configuration + assert: + that: + - config|success + +- name: test update configuration float + cs_configuration: + name: agent.load.threshold + value: 0.81 + register: config +- name: verify update configuration float + assert: + that: + - config|success + - config|changed + - config.value == "0.81" + - config.name == "agent.load.threshold" + +- name: test update configuration float idempotence + cs_configuration: + name: agent.load.threshold + value: 0.81 + register: config +- name: verify update configuration float idempotence + assert: + that: + - config|success + - not config|changed + - config.value == "0.81" + - config.name == "agent.load.threshold" + +- name: reset configuration float + cs_configuration: + name: agent.load.threshold + value: 0.7 + register: config +- name: verify reset configuration float + assert: + that: + - config|success + - config|changed + - config.value == "0.7" + - config.name == "agent.load.threshold" + +- include: storage.yml +- include: account.yml +- include: zone.yml +- include: cluster.yml diff --git a/test/integration/roles/test_cs_configuration/tasks/storage.yml b/test/integration/roles/test_cs_configuration/tasks/storage.yml new file mode 100644 index 00000000000..8201bae0572 --- /dev/null +++ b/test/integration/roles/test_cs_configuration/tasks/storage.yml @@ -0,0 +1,59 @@ +--- +- name: test configuration storage + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 2.0 + register: config +- name: verify test configuration storage + assert: + that: + - config|success + +- name: test update configuration storage + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 3.0 + register: config +- name: verify update configuration storage + assert: + that: + - config|success + - config|changed + - config.value == "3.0" + - config.name == "storage.overprovisioning.factor" + - config.scope == "storagepool" + - config.storage == "{{ test_cs_configuration_storage }}" + +- name: test update configuration storage idempotence + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 3.0 + register: config +- name: verify update configuration storage idempotence + assert: + that: + - config|success + - not config|changed + - config.value == "3.0" + - config.name == "storage.overprovisioning.factor" + - config.scope == "storagepool" + - config.storage == "{{ test_cs_configuration_storage }}" + +- name: test reset configuration storage + cs_configuration: + name: storage.overprovisioning.factor + storage: "{{ test_cs_configuration_storage }}" + value: 2.0 + register: config +- name: verify reset configuration storage + assert: + that: + - config|success + - config|changed + - config.value == "2.0" + - config.name == "storage.overprovisioning.factor" + - config.scope == "storagepool" + - config.storage == "{{ test_cs_configuration_storage }}" diff --git a/test/integration/roles/test_cs_configuration/tasks/zone.yml b/test/integration/roles/test_cs_configuration/tasks/zone.yml new file mode 100644 index 00000000000..423f885c7c0 --- /dev/null +++ b/test/integration/roles/test_cs_configuration/tasks/zone.yml @@ -0,0 +1,59 @@ +--- +- name: test configuration zone + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: false + register: config +- name: verify test configuration zone + assert: + that: + - config|success + +- name: test update configuration zone + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: true + register: config +- name: verify update configuration zone + assert: + that: + - config|success + - config|changed + - config.value == "true" + - config.name == "use.external.dns" + - config.scope == "zone" + - config.zone == "{{ test_cs_configuration_zone }}" + +- name: test update configuration zone idempotence + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: true + register: config +- name: verify update configuration zone idempotence + assert: + that: + - config|success + - not config|changed + - config.value == "true" + - config.name == "use.external.dns" + - config.scope == "zone" + - config.zone == "{{ test_cs_configuration_zone }}" + +- name: test reset configuration zone + cs_configuration: + name: use.external.dns + zone: "{{ test_cs_configuration_zone }}" + value: false + register: config +- name: verify reset configuration zone + assert: + that: + - config|success + - config|changed + - config.value == "false" + - config.name == "use.external.dns" + - config.scope == "zone" + - config.zone == "{{ test_cs_configuration_zone }}"