From 17961e6335b03ba8cb633a0372588d79c507e500 Mon Sep 17 00:00:00 2001 From: Rene Moser Date: Wed, 24 Apr 2019 16:18:11 +0200 Subject: [PATCH] tests: vultr: fix tests due to vultr API changes (#55621) (partly cherry picked from commit e0ea5bb) --- .../roles/vultr_plan_facts/tasks/main.yml | 4 +- .../roles/vultr_server/defaults/main.yml | 3 + test/legacy/roles/vultr_server/tasks/main.yml | 59 +++++++++++-------- .../roles/vultr_server_facts/tasks/main.yml | 6 +- 4 files changed, 41 insertions(+), 31 deletions(-) diff --git a/test/legacy/roles/vultr_plan_facts/tasks/main.yml b/test/legacy/roles/vultr_plan_facts/tasks/main.yml index 8efe5b738a8..519f3f883d8 100644 --- a/test/legacy/roles/vultr_plan_facts/tasks/main.yml +++ b/test/legacy/roles/vultr_plan_facts/tasks/main.yml @@ -8,7 +8,7 @@ - name: verify test gather vultr plan facts in check mode assert: that: - - ansible_facts.vultr_plan_facts|selectattr('name','equalto','16384 MB RAM,110 GB SSD,20.00 TB BW') | list | count == 1 + - ansible_facts.vultr_plan_facts|selectattr('name','equalto','16384 MB RAM,2x110 GB SSD,20.00 TB BW') | list | count == 1 - name: test gather vultr plan fact vultr_plan_facts: @@ -16,4 +16,4 @@ - name: verify test gather vultr plan facts assert: that: - - ansible_facts.vultr_plan_facts|selectattr('name','equalto','16384 MB RAM,110 GB SSD,20.00 TB BW') | list | count == 1 + - ansible_facts.vultr_plan_facts|selectattr('name','equalto','16384 MB RAM,2x110 GB SSD,20.00 TB BW') | list | count == 1 diff --git a/test/legacy/roles/vultr_server/defaults/main.yml b/test/legacy/roles/vultr_server/defaults/main.yml index dfe5b73bd36..77388aac7b1 100644 --- a/test/legacy/roles/vultr_server/defaults/main.yml +++ b/test/legacy/roles/vultr_server/defaults/main.yml @@ -7,3 +7,6 @@ vultr_server_ssh_keys: key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyWYItY+3w5b8PdGRoz0oY5mufqydW96naE+VM3JSvJFAUS08rAj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SSD,1.00 TB BW +vultr_server_plan_2: 2048 MB RAM,55 GB SSD,2.00 TB BW diff --git a/test/legacy/roles/vultr_server/tasks/main.yml b/test/legacy/roles/vultr_server/tasks/main.yml index d3269c78bca..913b5984860 100644 --- a/test/legacy/roles/vultr_server/tasks/main.yml +++ b/test/legacy/roles/vultr_server/tasks/main.yml @@ -47,7 +47,7 @@ vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 1024 MB RAM,25 GB SSD,1.00 TB BW + plan: "{{ vultr_server_plan_1 }}" ssh_keys: - key1 - key2 @@ -64,7 +64,7 @@ vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 1024 MB RAM,25 GB SSD,1.00 TB BW + plan: "{{ vultr_server_plan_1 }}" ssh_keys: - key1 - key2 @@ -77,7 +77,7 @@ - result is changed - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_1 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.power_status == 'running' @@ -85,7 +85,7 @@ vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 1024 MB RAM,25 GB SSD,1.00 TB BW + plan: "{{ vultr_server_plan_1 }}" ssh_keys: - key1 - key2 @@ -99,7 +99,7 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_1 - result.vultr_server.region == 'Amsterdam' - name: test stop an existing server in check mode @@ -192,7 +192,7 @@ vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW + plan: "{{ vultr_server_plan_2 }}" region: Amsterdam register: result check_mode: yes @@ -203,14 +203,14 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_1 - result.vultr_server.region == 'Amsterdam' - name: test update plan for server without force vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW + plan: "{{ vultr_server_plan_2 }}" region: Amsterdam register: result - name: verify test update plan for server without force @@ -220,7 +220,7 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_1 - result.vultr_server.region == 'Amsterdam' - name: setup firewall group @@ -264,7 +264,7 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_1 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.tag == '' - result.vultr_server.firewall_group != 'test_firewall_group' @@ -311,8 +311,9 @@ vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW + plan: "{{ vultr_server_plan_2 }}" auto_backup_enabled: yes + private_network_enabled: yes region: Amsterdam force: yes register: result @@ -324,16 +325,18 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_1 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.auto_backup_enabled == false + - result.vultr_server.internal_ip == '' - name: test update server with force vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW + plan: "{{ vultr_server_plan_2 }}" auto_backup_enabled: yes + private_network_enabled: yes region: Amsterdam force: yes register: result @@ -344,18 +347,20 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_2 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.auto_backup_enabled == true + - result.vultr_server.internal_ip != '' - name: test update server idempotence with force vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW - auto_backup_enabled: true + plan: "{{ vultr_server_plan_2 }}" + auto_backup_enabled: yes + private_network_enabled: yes region: Amsterdam - force: true + force: yes register: result - name: verify test update server idempotence with force assert: @@ -364,16 +369,17 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_2 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.auto_backup_enabled == true + - result.vultr_server.internal_ip != '' - name: test update server to stopped in check mode vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW - ipv6_enabled: true + plan: "{{ vultr_server_plan_2 }}" + ipv6_enabled: yes region: Amsterdam state: stopped register: result @@ -385,7 +391,7 @@ - result.vultr_server.power_status == 'running' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_2 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.v6_main_ip == '' @@ -393,8 +399,8 @@ vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW - ipv6_enabled: true + plan: "{{ vultr_server_plan_2 }}" + ipv6_enabled: yes region: Amsterdam state: stopped register: result @@ -405,7 +411,7 @@ - result.vultr_server.power_status == 'stopped' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_2 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.v6_main_ip != '' @@ -413,7 +419,8 @@ vultr_server: name: "{{ vultr_server_name }}" os: CentOS 6 x64 - plan: 2048 MB RAM,40 GB SSD,2.00 TB BW + plan: "{{ vultr_server_plan_2 }}" + ipv6_enabled: yes region: Amsterdam state: stopped register: result @@ -424,7 +431,7 @@ - result.vultr_server.power_status == 'stopped' - result.vultr_server.name == '{{ vultr_server_name }}' - result.vultr_server.os == 'CentOS 6 x64' - - result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW' + - result.vultr_server.plan == vultr_server_plan_2 - result.vultr_server.region == 'Amsterdam' - result.vultr_server.v6_main_ip != '' diff --git a/test/legacy/roles/vultr_server_facts/tasks/main.yml b/test/legacy/roles/vultr_server_facts/tasks/main.yml index 95af65e7ee1..9d75df55444 100644 --- a/test/legacy/roles/vultr_server_facts/tasks/main.yml +++ b/test/legacy/roles/vultr_server_facts/tasks/main.yml @@ -17,7 +17,7 @@ - name: verify test gather vultr server facts - empty resources assert: that: - - ansible_facts.vultr_server_facts | count == 0 + - ansible_facts.vultr_server_facts | selectattr('name','equalto',vultr_server_name) | list | count == 0 - name: setup firewall group vultr_firewall_group: @@ -38,7 +38,7 @@ - name: verify test gather vultr server facts in check mode assert: that: - - ansible_facts.vultr_server_facts|selectattr('name','equalto','{{ vultr_server_name }}') | list | count == 1 + - ansible_facts.vultr_server_facts|selectattr('name','equalto',vultr_server_name) | list | count == 1 - name: test gather vultr server facts vultr_server_facts: @@ -46,7 +46,7 @@ - name: verify test gather vultr server facts assert: that: - - ansible_facts.vultr_server_facts|selectattr('name','equalto','{{ vultr_server_name }}') | list | count == 1 + - ansible_facts.vultr_server_facts|selectattr('name','equalto',vultr_server_name) | list | count == 1 - name: Pause for 5 min before deleting the VM pause: