From 8544bc5b2abaed9c725c6d43bd57f11ffe02db38 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Tue, 29 May 2018 14:22:59 +0800 Subject: [PATCH] fixing three unstable integration tests (#40804) --- .../targets/azure_rm_loadbalancer/aliases | 1 - .../azure_rm_loadbalancer/tasks/main.yml | 54 +++++++++++-------- .../targets/azure_rm_securitygroup/aliases | 1 - .../azure_rm_securitygroup/tasks/main.yml | 22 +++++--- .../targets/azure_rm_virtualnetwork/aliases | 1 - .../azure_rm_virtualnetwork/tasks/main.yml | 28 +++++----- 6 files changed, 61 insertions(+), 46 deletions(-) diff --git a/test/integration/targets/azure_rm_loadbalancer/aliases b/test/integration/targets/azure_rm_loadbalancer/aliases index 44e6c25ba7..17006e57f6 100644 --- a/test/integration/targets/azure_rm_loadbalancer/aliases +++ b/test/integration/targets/azure_rm_loadbalancer/aliases @@ -1,4 +1,3 @@ cloud/azure posix/ci/cloud/group3/azure -unstable destructive diff --git a/test/integration/targets/azure_rm_loadbalancer/tasks/main.yml b/test/integration/targets/azure_rm_loadbalancer/tasks/main.yml index 4739eda01e..06b4cad7f7 100644 --- a/test/integration/targets/azure_rm_loadbalancer/tasks/main.yml +++ b/test/integration/targets/azure_rm_loadbalancer/tasks/main.yml @@ -1,26 +1,34 @@ +- name: Prepare random number + set_fact: + pipaname: "pipa{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + pipbname: "pipb{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + lbname: "lb{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + lbvnname: "lbvn{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + run_once: yes + - name: create public ip azure_rm_publicipaddress: - name: ansiblepipstandard + name: "{{ pipbname }}" sku: Standard allocation_method: Static resource_group: '{{ resource_group }}' - name: create public ip azure_rm_publicipaddress: - name: ansiblepip3 + name: "{{ pipaname }}" resource_group: '{{ resource_group }}' - name: clear load balancer azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" state: absent - name: create load balancer azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible - public_ip: ansiblepip3 + name: "{{ lbname }}" + public_ip: "{{ pipaname }}" register: output - name: assert load balancer created @@ -30,7 +38,7 @@ - name: delete load balancer azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" state: absent register: output @@ -41,7 +49,7 @@ - name: delete load balancer (idempotent) azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" state: absent register: output @@ -52,9 +60,9 @@ - name: create another load balancer with more options azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" sku: Standard - public_ip_address: ansiblepipstandard + public_ip_address: "{{ pipbname }}" probe_protocol: Tcp probe_port: 80 probe_interval: 10 @@ -79,16 +87,16 @@ - name: delete load balancer azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" state: absent - name: create load balancer with multiple parameters azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" frontend_ip_configurations: - name: frontendipconf0 - public_ip_address: ansiblepip3 + public_ip_address: "{{ pipaname }}" backend_address_pools: - name: backendaddrpool0 probes: @@ -117,27 +125,27 @@ - name: delete load balancer azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" state: absent - name: Create virtual network azure_rm_virtualnetwork: resource_group: "{{ resource_group }}" - name: lbtestfromansiblevn + name: "{{ lbvnname }}" address_prefixes: "10.10.0.0/16" - name: Add subnet azure_rm_subnet: resource_group: "{{ resource_group }}" - name: lbtestfromansiblesb + name: "lb{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}sb" address_prefix: "10.10.0.0/24" - virtual_network: lbtestfromansiblevn + virtual_network: "{{ lbvnname }}" register: subnet - name: create internal loadbalancer azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" frontend_ip_configurations: - name: frontendipconf0 private_ip_address: 10.10.0.10 @@ -171,7 +179,7 @@ - name: delete load balancer azure_rm_loadbalancer: resource_group: '{{ resource_group }}' - name: lbtestfromansible + name: "{{ lbname }}" state: absent - name: cleanup public ip @@ -180,18 +188,18 @@ resource_group: '{{ resource_group }}' state: absent with_items: - - ansiblepip3 - - ansiblepipstandard + - "{{ pipaname }}" + - "{{ pipbname }}" - name: cleanup subnet azure_rm_subnet: resource_group: "{{ resource_group }}" - name: lbtestfromansiblesb - virtual_network: lbtestfromansiblevn + name: "lb{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}sb" + virtual_network: "{{ lbvnname }}" state: absent - name: cleanup virtual network azure_rm_virtualnetwork: resource_group: "{{ resource_group }}" - name: lbtestfromansiblevn + name: "{{ lbvnname }}" state: absent diff --git a/test/integration/targets/azure_rm_securitygroup/aliases b/test/integration/targets/azure_rm_securitygroup/aliases index 2b386bc9d2..6622a9d9bc 100644 --- a/test/integration/targets/azure_rm_securitygroup/aliases +++ b/test/integration/targets/azure_rm_securitygroup/aliases @@ -1,5 +1,4 @@ cloud/azure posix/ci/cloud/group2/azure -unstable destructive azure_rm_securitygroup_facts diff --git a/test/integration/targets/azure_rm_securitygroup/tasks/main.yml b/test/integration/targets/azure_rm_securitygroup/tasks/main.yml index 6bbea0fd65..4c033258ed 100644 --- a/test/integration/targets/azure_rm_securitygroup/tasks/main.yml +++ b/test/integration/targets/azure_rm_securitygroup/tasks/main.yml @@ -1,7 +1,13 @@ +- name: Prepare random number + set_fact: + secgroupname: "sg{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + run_once: yes + + - name: Create security group azure_rm_securitygroup: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" tags: testing: testing delete: on-exit @@ -39,7 +45,7 @@ - name: Add/Update rules on existing security group azure_rm_securitygroup: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" rules: - name: AllowSSH protocol: Tcp @@ -62,7 +68,7 @@ - name: Test idempotence azure_rm_securitygroup: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" rules: - name: AllowSSH protocol: Tcp @@ -83,7 +89,7 @@ - name: Update tags azure_rm_securitygroup: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" tags: testing: testing delete: never @@ -98,7 +104,7 @@ - name: Purge tags azure_rm_securitygroup: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" tags: testing: testing delete: on-exit @@ -112,7 +118,7 @@ - name: Gather facts for one accounts azure_rm_securitygroup_facts: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" register: output - assert: @@ -131,7 +137,7 @@ - name: Create security group with source_address_prefixes azure_rm_securitygroup: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" tags: testing: testing delete: on-exit @@ -159,7 +165,7 @@ - name: Create security group with source_address_prefixes(idempontent) azure_rm_securitygroup: resource_group: "{{ resource_group }}" - name: mysecgroup + name: "{{ secgroupname }}" tags: testing: testing delete: on-exit diff --git a/test/integration/targets/azure_rm_virtualnetwork/aliases b/test/integration/targets/azure_rm_virtualnetwork/aliases index 41d4983007..9e23ddb721 100644 --- a/test/integration/targets/azure_rm_virtualnetwork/aliases +++ b/test/integration/targets/azure_rm_virtualnetwork/aliases @@ -1,4 +1,3 @@ cloud/azure posix/ci/cloud/group2/azure destructive -unstable diff --git a/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml b/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml index 7554be5149..b42378e897 100644 --- a/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml +++ b/test/integration/targets/azure_rm_virtualnetwork/tasks/main.yml @@ -1,12 +1,16 @@ +- name: Prepare random number + set_fact: + vnetname: "vnet{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + - name: Delete virtual network, if it exists azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" resource_group: "{{ resource_group }}" state: absent - name: Create virtual network azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" address_prefixes_cidr: - 10.1.0.0/16 - 172.100.0.0/16 @@ -17,7 +21,7 @@ - name: Create virtual network azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" address_prefixes_cidr: - 10.1.0.0/16 - 172.100.0.0/16 @@ -40,7 +44,7 @@ - name: Gather facts by name, tags azure_rm_virtualnetwork_facts: resource_group: "{{ resource_group }}" - name: my_test_network + name: "{{ vnetname }}" tags: - testing @@ -66,7 +70,7 @@ - name: Should be idempotent azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" address_prefixes_cidr: - 10.1.0.0/16 - 172.100.0.0/16 @@ -84,7 +88,7 @@ - name: Update tags azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" tags: testing: 'no' delete: never @@ -97,7 +101,7 @@ - name: Purge tags azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" tags: testing: 'always' resource_group: "{{ resource_group }}" @@ -110,7 +114,7 @@ - name: Should require address_prefixes_cidr when purge_address_prefixes azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" purge_address_prefixes: true resource_group: "{{ resource_group }}" register: output @@ -121,7 +125,7 @@ - name: Purge address prefixes azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" address_prefixes_cidr: 10.1.0.0/16 purge_address_prefixes: true resource_group: "{{ resource_group }}" @@ -136,7 +140,7 @@ - name: Purge DNS servers azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" purge_dns_servers: true resource_group: "{{ resource_group }}" register: output @@ -147,13 +151,13 @@ - name: Gather facts azure_rm_virtualnetwork_facts: resource_group: "{{ resource_group }}" - name: my_test_network + name: "{{ vnetname }}" - assert: that: "azure_virtualnetworks | length == 1" - name: Delete virtual network azure_rm_virtualnetwork: - name: my_test_network + name: "{{ vnetname }}" resource_group: "{{ resource_group }}" state: absent