From f2db4602035dab03cb2ba8e64191258b015559d0 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 25 Apr 2014 14:38:55 -0500 Subject: [PATCH] A few updates to the ec2_elb_lb integration test --- test/integration/amazon.yml | 2 +- .../roles/test_ec2_elb_lb/tasks/main.yml | 83 ++++++++----------- 2 files changed, 36 insertions(+), 49 deletions(-) diff --git a/test/integration/amazon.yml b/test/integration/amazon.yml index 6fe692067a1..867b4dcf5da 100644 --- a/test/integration/amazon.yml +++ b/test/integration/amazon.yml @@ -7,7 +7,7 @@ #- { role: test_ec2_vol, tags: test_ec2_vol } #- { role: test_ec2_tag, tags: test_ec2_tag } #- { role: test_ec2_facts, tags: test_ec2_facts } - #- { role: test_ec2_elb_lb, tags: test_ec2_elb_lb } + - { role: test_ec2_elb_lb, tags: test_ec2_elb_lb } #- { role: test_ec2_eip, tags: test_ec2_eip } #- { role: test_ec2_elb, tags: test_ec2_elb } #- { role: test_ec2_ami, tags: test_ec2_ami } diff --git a/test/integration/roles/test_ec2_elb_lb/tasks/main.yml b/test/integration/roles/test_ec2_elb_lb/tasks/main.yml index efc2affb26a..297bd84196b 100644 --- a/test/integration/roles/test_ec2_elb_lb/tasks/main.yml +++ b/test/integration/roles/test_ec2_elb_lb/tasks/main.yml @@ -41,11 +41,9 @@ - protocol: http load_balancer_port: 80 instance_port: 80 - - protocol: https - load_balancer_port: 443 - instance_protocol: http - instance_port: 80 - ssl_certificate_id: "{{ elb_lb_cert }}" + - protocol: http + load_balancer_port: 8080 + instance_port: 8080 health_check: ping_protocol: http ping_port: 80 @@ -68,15 +66,9 @@ - 'info.elb.health_check.target == "HTTP:80/index.html"' - 'info.elb.health_check.timeout == 5' - 'info.elb.health_check.unhealthy_threshold == 2' - - 'info.elb.listeners[0][0] == 80' - - 'info.elb.listeners[0][1] == 80' - - 'info.elb.listeners[0][2] == "HTTP"' - - 'info.elb.listeners[0][3] == "HTTP"' - - 'info.elb.listeners[1][0] == 443' - - 'info.elb.listeners[1][1] == 80' - - 'info.elb.listeners[1][2] == "HTTPS"' - - 'info.elb.listeners[1][3] == "HTTP"' - - 'info.elb.listeners[1][4] == "{{ elb_lb_cert }}"' + - '[80, 80, "HTTP", "HTTP"] in info.elb.listeners' + - '[8080, 8080, "HTTP", "HTTP"] in info.elb.listeners' + # ============================================================ # check ports, would be cool, but we are at the mercy of AWS @@ -113,11 +105,6 @@ - protocol: http load_balancer_port: 80 instance_port: 80 - - protocol: https - load_balancer_port: 443 - instance_protocol: http - instance_port: 80 - ssl_certificate_id: "{{ elb_lb_cert }}" purge_zones: yes health_check: ping_protocol: http @@ -157,11 +144,6 @@ - protocol: http load_balancer_port: 80 instance_port: 80 - - protocol: https - load_balancer_port: 443 - instance_protocol: http - instance_port: 80 - ssl_certificate_id: "{{ elb_lb_cert }}" purge_zones: yes register: info @@ -170,9 +152,9 @@ - '"failed" not in info' - 'info.changed' - 'info.elb.status == "ok"' - - 'info.elb.zones[0] == "us-east-1b"' - - 'info.elb.zones[1] == "us-east-1c"' - - 'info.elb.zones[2] == "us-east-1d"' + - '"us-east-1b" in info.elb.zones' + - '"us-east-1c" in info.elb.zones' + - '"us-east-1d" in info.elb.zones' # ============================================================ @@ -202,9 +184,8 @@ - '"failed" not in info' - 'info.elb.status == "ok"' - 'info.changed' - - 'info.elb.listeners[0][0] == 80' - - 'info.elb.listeners[0][1] == 81' - - 'len(info.elb.listeners) == 1' + - '[80, 81, "HTTP", "HTTP"] in info.elb.listeners' + - 'info.elb.listeners|length == 1' @@ -225,14 +206,9 @@ - us-east-1d listeners: - protocol: http - load_balancer_port: 80 - instance_port: 81 - - protocol: https - load_balancer_port: 443 - instance_protocol: http - instance_port: 80 - ssl_certificate_id: "{{ elb_lb_cert }}" - purge_listeners: yes + load_balancer_port: 8081 + instance_port: 8081 + purge_listeners: no register: info - assert: @@ -240,16 +216,9 @@ - '"failed" not in info' - 'info.elb.status == "ok"' - 'info.changed' - - 'info.elb.listeners[0][0] == 80' - - 'info.elb.listeners[0][1] == 80' - - 'info.elb.listeners[0][2] == "HTTP"' - - 'info.elb.listeners[0][3] == "HTTP"' - - 'info.elb.listeners[1][0] == 443' - - 'info.elb.listeners[1][1] == 80' - - 'info.elb.listeners[1][2] == "HTTPS"' - - 'info.elb.listeners[1][3] == "HTTP"' - - 'info.elb.listeners[1][4] == "{{ elb_lb_cert }}"' - - 'len(info.elb.listeners) == 2' + - '[80, 81, "HTTP", "HTTP"] in info.elb.listeners' + - '[8081, 8081, "HTTP", "HTTP"] in info.elb.listeners' + - 'info.elb.listeners|length == 2' # ============================================================ @@ -419,3 +388,21 @@ that: - 'result.failed' - '"No handler was ready to authenticate. 1 handlers were checked." in result.msg' + +# ============================================================ +- name: remove the test load balancer completely + ec2_elb_lb: + name: "{{ tag_prefix }}" + region: "{{ ec2_region }}" + state: absent + ec2_access_key: "{{ ec2_access_key }}" + ec2_secret_key: "{{ ec2_secret_key }}" + register: result + +- name: assert the load balancer was removed + assert: + that: + - 'result.changed' + - 'result.elb.name == "{{tag_prefix}}"' + - 'result.elb.status == "deleted"' +