Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneed waits in test cases #1374

Merged
merged 3 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugins/modules/azure_rm_mysqldatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

try:
from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
from azure.core.exceptions import ResourceNotFoundError
from azure.core.exceptions import ResourceNotFoundError, HttpResponseError
from azure.core.polling import LROPoller
except ImportError:
# This is handled in azure_rm_common
Expand Down Expand Up @@ -282,6 +282,8 @@ def get_mysqldatabase(self):
self.log("MySQL Database instance : {0} found".format(response.name))
except ResourceNotFoundError as e:
self.log('Did not find the MySQL Database instance.')
except HttpResponseError as e:
self.log("Get MySQL Database instance error. code: {0}, message: {1}".format(e.status_code, str(e.error)))
if found is True:
return response.as_dict()

Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/azure_rm_mysqldatabase_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

try:
from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
from azure.core.exceptions import ResourceNotFoundError
from azure.core.exceptions import ResourceNotFoundError, HttpResponseError
except ImportError:
# This is handled in azure_rm_common
pass
Expand Down Expand Up @@ -159,6 +159,8 @@ def get(self):
self.log("Response : {0}".format(response))
except ResourceNotFoundError as e:
self.log('Could not get facts for Databases.')
except HttpResponseError as e:
self.log("Get MySQL Database instance error. code: {0}, message: {1}".format(e.status_code, str(e.error)))

if response is not None:
results.append(self.format_item(response))
Expand Down
5 changes: 0 additions & 5 deletions tests/integration/targets/azure_rm_gallery/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@
name: "vmforimage{{ rpfx }}"
register: output

- name: Pause for 10 mimutes to VM updating
ansible.builtin.command:
sleep 600
changed_when: true

- name: Create a snapshot by importing an unmanaged blob from the same subscription.
azure_rm_snapshot:
resource_group: "{{ resource_group }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
name: "{{ vm_name }}"
register: vm_state

- name: Pause for 10 mimutes to VM updating
ansible.builtin.command: sleep 600
changed_when: true

- name: Restart the virtual machine
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@
name: "{{ vm_name }}"
register: vm_state

- name: Pause for 10 mimutes to VM updating
ansible.builtin.command: sleep 600
changed_when: true

- name: Generalize VM
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}" # Should this be resource_group_secondary?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
name: "{{ vm_name }}"
register: vm_state

- name: Pause for 10 mimutes to VM updating
ansible.builtin.command: sleep 600
changed_when: true

- name: Generalize VM
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@
#!/bin/sh
echo "custom_data was executed" > /tmp/custom_data.txt

- name: Pause for 10 mimutes to VM updating
ansible.builtin.command: sleep 600
changed_when: true

- name: Ensure VM was created properly
ansible.builtin.assert:
that:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@
resource_group: "{{ resource_group }}"
name: "vmforimage{{ rpfx }}"
register: vm_state
- name: Pause for 10 mimutes to VM updating
ansible.builtin.command: sleep 600
changed_when: true
- name: Generalize VM
azure_rm_virtualmachine:
resource_group: "{{ resource_group }}"
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/targets/inventory_azure/playbooks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,3 @@
sku: 20_04-lts
version: latest
register: vm_output

- name: Pause for 5 mimutes for updating
ansible.builtin.command: sleep 300
changed_when: false