From e284d2113981b50dd924ecc06f349adda87d2a13 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 6 Feb 2019 05:28:49 +1000 Subject: [PATCH] win_rds: move the tests into 1 target to make it quicker (#51728) --- .../targets/setup_win_rds/handlers/main.yml | 29 ---------- .../targets/setup_win_rds/tasks/main.yml | 29 ---------- test/integration/targets/win_rds/aliases | 6 ++ .../targets/win_rds/defaults/main.yml | 9 +++ .../targets/win_rds/tasks/main.yml | 58 +++++++++++++++++++ .../tasks/win_rds_cap.yml} | 3 +- .../tasks/win_rds_cap_tests.yml} | 0 .../tasks/win_rds_rap.yml} | 3 +- .../tasks/win_rds_rap_tests.yml} | 0 .../tasks/win_rds_settings.yml} | 6 +- .../tasks/win_rds_settings_tests.yml} | 0 .../templates/rds_base_cfg.xml.j2 | 0 test/integration/targets/win_rds_cap/aliases | 3 - .../targets/win_rds_cap/defaults/main.yml | 1 - .../targets/win_rds_cap/meta/main.yml | 3 - test/integration/targets/win_rds_rap/aliases | 3 - .../targets/win_rds_rap/defaults/main.yml | 1 - .../targets/win_rds_rap/meta/main.yml | 2 - .../targets/win_rds_settings/aliases | 3 - .../win_rds_settings/defaults/main.yml | 2 - .../targets/win_rds_settings/meta/main.yml | 2 - 21 files changed, 77 insertions(+), 86 deletions(-) delete mode 100644 test/integration/targets/setup_win_rds/handlers/main.yml delete mode 100644 test/integration/targets/setup_win_rds/tasks/main.yml create mode 100644 test/integration/targets/win_rds/aliases create mode 100644 test/integration/targets/win_rds/defaults/main.yml create mode 100644 test/integration/targets/win_rds/tasks/main.yml rename test/integration/targets/{win_rds_cap/tasks/main.yml => win_rds/tasks/win_rds_cap.yml} (72%) rename test/integration/targets/{win_rds_cap/tasks/tests.yml => win_rds/tasks/win_rds_cap_tests.yml} (100%) rename test/integration/targets/{win_rds_rap/tasks/main.yml => win_rds/tasks/win_rds_rap.yml} (72%) rename test/integration/targets/{win_rds_rap/tasks/tests.yml => win_rds/tasks/win_rds_rap_tests.yml} (100%) rename test/integration/targets/{win_rds_settings/tasks/main.yml => win_rds/tasks/win_rds_settings.yml} (95%) rename test/integration/targets/{win_rds_settings/tasks/tests.yml => win_rds/tasks/win_rds_settings_tests.yml} (100%) rename test/integration/targets/{win_rds_settings => win_rds}/templates/rds_base_cfg.xml.j2 (100%) delete mode 100644 test/integration/targets/win_rds_cap/aliases delete mode 100644 test/integration/targets/win_rds_cap/defaults/main.yml delete mode 100644 test/integration/targets/win_rds_cap/meta/main.yml delete mode 100644 test/integration/targets/win_rds_rap/aliases delete mode 100644 test/integration/targets/win_rds_rap/defaults/main.yml delete mode 100644 test/integration/targets/win_rds_rap/meta/main.yml delete mode 100644 test/integration/targets/win_rds_settings/aliases delete mode 100644 test/integration/targets/win_rds_settings/defaults/main.yml delete mode 100644 test/integration/targets/win_rds_settings/meta/main.yml diff --git a/test/integration/targets/setup_win_rds/handlers/main.yml b/test/integration/targets/setup_win_rds/handlers/main.yml deleted file mode 100644 index d8f600319d5..00000000000 --- a/test/integration/targets/setup_win_rds/handlers/main.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Server 2008 R2 requires us to remove this first before the other features -- name: remove the RDS-Gateway feature - win_feature: - name: RDS-Gateway - state: absent - listen: remove RDS feature - register: rds_uninstall - -- name: reboot after removing RDS-Gateway feature - win_reboot: - when: rds_uninstall.reboot_required - listen: remove RDS feature - -# Now remove the remaining features -- name: remove installed RDS feature - win_feature: - name: - - RDS-Licensing - - RDS-RD-Server - - Web-Server # not part of the initial feature install but RDS-Gateway requires this and it breaks httptester - state: absent - listen: remove RDS feature - register: rds_uninstall2 - -- name: reboot after feature removal - win_reboot: - when: rds_uninstall2.reboot_required - listen: remove RDS feature diff --git a/test/integration/targets/setup_win_rds/tasks/main.yml b/test/integration/targets/setup_win_rds/tasks/main.yml deleted file mode 100644 index 2c36455aec1..00000000000 --- a/test/integration/targets/setup_win_rds/tasks/main.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# Cannot use win_feature to install RDS on Server 2008 -- name: check if feature is availble - win_shell: if (Get-Command -Name Add-WindowsFeature -ErrorAction SilentlyContinue) { $true } else { $false } - changed_when: False - register: module_available - -- name: set fact when RDS is available - set_fact: - rds_available: '{{ module_available.stdout | trim | bool }}' - -- name: install Remote Desktop Gateway features - when: rds_available - block: - - name: ensure Remote Desktop Gateway services are installed - win_feature: - name: - - RDS-Gateway - - RDS-Licensing - - RDS-RD-Server - state: present - register: rds_install - notify: - - remove RDS feature - - - name: reboot server if needed - win_reboot: - post_reboot_delay: 10 - when: rds_install.reboot_required diff --git a/test/integration/targets/win_rds/aliases b/test/integration/targets/win_rds/aliases new file mode 100644 index 00000000000..45fede70029 --- /dev/null +++ b/test/integration/targets/win_rds/aliases @@ -0,0 +1,6 @@ +shippable/windows/group3 +destructive +skip/windows/2008 # win_feature is required to install the RDS feature and that doesn't support 2008 +win_rds_cap +win_rds_rap +win_rds_settings diff --git a/test/integration/targets/win_rds/defaults/main.yml b/test/integration/targets/win_rds/defaults/main.yml new file mode 100644 index 00000000000..4bc62eff127 --- /dev/null +++ b/test/integration/targets/win_rds/defaults/main.yml @@ -0,0 +1,9 @@ +# win_rds_cap +test_win_rds_cap_name: Ansible Test CAP + +# win_rds_rap +test_win_rds_rap_name: Ansible Test RAP + +# win_rds_settings +test_win_rds_settings_path: '{{win_output_dir}}\win_rds_settings' +rds_cert_suject: rdg.test.com diff --git a/test/integration/targets/win_rds/tasks/main.yml b/test/integration/targets/win_rds/tasks/main.yml new file mode 100644 index 00000000000..82a7275bd1d --- /dev/null +++ b/test/integration/targets/win_rds/tasks/main.yml @@ -0,0 +1,58 @@ +--- +# Cannot use win_feature to install RDS on Server 2008 +- name: check if feature is availble + win_shell: if (Get-Command -Name Add-WindowsFeature -ErrorAction SilentlyContinue) { $true } else { $false } + changed_when: False + register: module_available + +- name: install Remote Desktop Gateway features + when: module_available.stdout | trim | bool + block: + - name: ensure Remote Desktop Gateway services are installed + win_feature: + name: + - RDS-Gateway + - RDS-Licensing + - RDS-RD-Server + state: present + register: rds_install + + - name: reboot server if needed + win_reboot: + post_reboot_delay: 10 + when: rds_install.reboot_required + + - name: run win_rds_cap integration tests + include_tasks: win_rds_cap.yml + + - name: run win_rds_rap integration tests + include_tasks: win_rds_rap.yml + + - name: run win_rds_settings integration tests + include_tasks: win_rds_settings.yml + + always: + # Server 2008 R2 requires us to remove this first before the other features + - name: remove the RDS-Gateway feature + win_feature: + name: RDS-Gateway + state: absent + register: rds_uninstall + + - name: reboot after removing RDS-Gateway feature + win_reboot: + when: rds_uninstall.reboot_required + + # Now remove the remaining features + - name: remove installed RDS feature + win_feature: + name: + - RDS-Licensing + - RDS-RD-Server + - Web-Server # not part of the initial feature install but RDS-Gateway requires this and it breaks httptester + state: absent + register: rds_uninstall2 + + - name: reboot after feature removal + win_reboot: + when: rds_uninstall2.reboot_required diff --git a/test/integration/targets/win_rds_cap/tasks/main.yml b/test/integration/targets/win_rds/tasks/win_rds_cap.yml similarity index 72% rename from test/integration/targets/win_rds_cap/tasks/main.yml rename to test/integration/targets/win_rds/tasks/win_rds_cap.yml index f4867686842..41ed2e6e4c8 100644 --- a/test/integration/targets/win_rds_cap/tasks/main.yml +++ b/test/integration/targets/win_rds/tasks/win_rds_cap.yml @@ -1,9 +1,8 @@ --- - name: run tests with cleanup - when: rds_available # defined in setup_win_rds block: - name: run tests - include_tasks: tests.yml + include_tasks: win_rds_cap_tests.yml always: - name: delete all CAPs diff --git a/test/integration/targets/win_rds_cap/tasks/tests.yml b/test/integration/targets/win_rds/tasks/win_rds_cap_tests.yml similarity index 100% rename from test/integration/targets/win_rds_cap/tasks/tests.yml rename to test/integration/targets/win_rds/tasks/win_rds_cap_tests.yml diff --git a/test/integration/targets/win_rds_rap/tasks/main.yml b/test/integration/targets/win_rds/tasks/win_rds_rap.yml similarity index 72% rename from test/integration/targets/win_rds_rap/tasks/main.yml rename to test/integration/targets/win_rds/tasks/win_rds_rap.yml index d11512226df..561f6ead038 100644 --- a/test/integration/targets/win_rds_rap/tasks/main.yml +++ b/test/integration/targets/win_rds/tasks/win_rds_rap.yml @@ -1,9 +1,8 @@ --- - name: run tests with cleanup - when: rds_available # defined in setup_win_rds block: - name: run tests - include_tasks: tests.yml + include_tasks: win_rds_rap_tests.yml always: - name: delete all RAPs diff --git a/test/integration/targets/win_rds_rap/tasks/tests.yml b/test/integration/targets/win_rds/tasks/win_rds_rap_tests.yml similarity index 100% rename from test/integration/targets/win_rds_rap/tasks/tests.yml rename to test/integration/targets/win_rds/tasks/win_rds_rap_tests.yml diff --git a/test/integration/targets/win_rds_settings/tasks/main.yml b/test/integration/targets/win_rds/tasks/win_rds_settings.yml similarity index 95% rename from test/integration/targets/win_rds_settings/tasks/main.yml rename to test/integration/targets/win_rds/tasks/win_rds_settings.yml index b0c4817f461..08e291fbca3 100644 --- a/test/integration/targets/win_rds_settings/tasks/main.yml +++ b/test/integration/targets/win_rds/tasks/win_rds_settings.yml @@ -1,6 +1,4 @@ ---- - name: run tests with cleanup - when: rds_available # defined in setup_win_rds block: - name: gather facts setup: @@ -46,8 +44,8 @@ raw: '(gci Cert:\LocalMachine\my | ? {$_.subject -eq "CN={{ rds_cert_suject }}"})[0].Thumbprint' register: rds_cert_thumbprint -# - name: run tests -# include_tasks: tests.yml + - name: run tests + include_tasks: win_rds_settings_tests.yml always: - name: restore RDS base configuration diff --git a/test/integration/targets/win_rds_settings/tasks/tests.yml b/test/integration/targets/win_rds/tasks/win_rds_settings_tests.yml similarity index 100% rename from test/integration/targets/win_rds_settings/tasks/tests.yml rename to test/integration/targets/win_rds/tasks/win_rds_settings_tests.yml diff --git a/test/integration/targets/win_rds_settings/templates/rds_base_cfg.xml.j2 b/test/integration/targets/win_rds/templates/rds_base_cfg.xml.j2 similarity index 100% rename from test/integration/targets/win_rds_settings/templates/rds_base_cfg.xml.j2 rename to test/integration/targets/win_rds/templates/rds_base_cfg.xml.j2 diff --git a/test/integration/targets/win_rds_cap/aliases b/test/integration/targets/win_rds_cap/aliases deleted file mode 100644 index a22cd11c77d..00000000000 --- a/test/integration/targets/win_rds_cap/aliases +++ /dev/null @@ -1,3 +0,0 @@ -shippable/windows/group3 -destructive -skip/windows/2008 # win_feature is requires to install the RDS feature and that doesn't support 2008 diff --git a/test/integration/targets/win_rds_cap/defaults/main.yml b/test/integration/targets/win_rds_cap/defaults/main.yml deleted file mode 100644 index 174d09e3d7a..00000000000 --- a/test/integration/targets/win_rds_cap/defaults/main.yml +++ /dev/null @@ -1 +0,0 @@ -test_win_rds_cap_name: Ansible Test CAP \ No newline at end of file diff --git a/test/integration/targets/win_rds_cap/meta/main.yml b/test/integration/targets/win_rds_cap/meta/main.yml deleted file mode 100644 index 94bf35a7d42..00000000000 --- a/test/integration/targets/win_rds_cap/meta/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: -- setup_win_rds diff --git a/test/integration/targets/win_rds_rap/aliases b/test/integration/targets/win_rds_rap/aliases deleted file mode 100644 index a22cd11c77d..00000000000 --- a/test/integration/targets/win_rds_rap/aliases +++ /dev/null @@ -1,3 +0,0 @@ -shippable/windows/group3 -destructive -skip/windows/2008 # win_feature is requires to install the RDS feature and that doesn't support 2008 diff --git a/test/integration/targets/win_rds_rap/defaults/main.yml b/test/integration/targets/win_rds_rap/defaults/main.yml deleted file mode 100644 index ada12c20c38..00000000000 --- a/test/integration/targets/win_rds_rap/defaults/main.yml +++ /dev/null @@ -1 +0,0 @@ -test_win_rds_rap_name: Ansible Test RAP \ No newline at end of file diff --git a/test/integration/targets/win_rds_rap/meta/main.yml b/test/integration/targets/win_rds_rap/meta/main.yml deleted file mode 100644 index fbb6d056848..00000000000 --- a/test/integration/targets/win_rds_rap/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- setup_win_rds diff --git a/test/integration/targets/win_rds_settings/aliases b/test/integration/targets/win_rds_settings/aliases deleted file mode 100644 index 6a92830ec48..00000000000 --- a/test/integration/targets/win_rds_settings/aliases +++ /dev/null @@ -1,3 +0,0 @@ -shippable/windows/group1 -destructive -skip/windows/2008 # win_feature is requires to install the RDS feature and that doesn't support 2008 diff --git a/test/integration/targets/win_rds_settings/defaults/main.yml b/test/integration/targets/win_rds_settings/defaults/main.yml deleted file mode 100644 index dfdc9647684..00000000000 --- a/test/integration/targets/win_rds_settings/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -test_win_rds_settings_path: '{{win_output_dir}}\win_rds_settings' -rds_cert_suject: rdg.test.com \ No newline at end of file diff --git a/test/integration/targets/win_rds_settings/meta/main.yml b/test/integration/targets/win_rds_settings/meta/main.yml deleted file mode 100644 index fbb6d056848..00000000000 --- a/test/integration/targets/win_rds_settings/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- setup_win_rds