 
 (fact "that waiting for load balancer health of auto scaling group with not enough healthy instances retries"
       (wait-for-load-balancers-to-be-healthy {:attempt 1
-                                              :parameters wait-for-load-balancers-to-be-healthy-params}) => {:status :retry
-                                                                                                             :backoff-ms 10000}
+                                              :parameters wait-for-load-balancers-to-be-healthy-params})
+      => {:status :retry
+          :backoff-ms 10000}
       (provided
        (aws/auto-scaling-group-instances "asg" "environment" "region") => [{:instance-id "id-1"} {:instance-id "id-2"}]
        (aws/load-balancer-health "environment" "region" "lb-1") => [{:instance-id "id-1" :state "NotInService"}


(fact "that waiting for load balancer health uses given maximum attempts"
      (wait-for-load-balancers-to-be-healthy {:attempt 12
                                              :parameters (assoc-in wait-for-load-balancers-to-be-healthy-params [:new-state :tyranitar :deployment-params :load-balancer-healthy-attempts] 12)}) => (contains {:status :error})
      (provided
       (aws/auto-scaling-group-instances "asg" "environment" "region") => [{:instance-id "id-1"} {:instance-id "id-2"}]
       (aws/load-balancer-health "environment" "region" "lb-1") => [{:instance-id "id-1" :state "NotInService"}

       (http/simple-get "http://ip2:9090/the/healthcheck" {:socket-timeout 2000}) =throws=> (ex-info "Busted" {})))

(fact "that getting an exception while attempting to retrieve the instance details is an error"
      (wait-for-instances-to-be-healthy {:attempt 1 :parameters wait-for-instances-to-be-healthy-params})
      => (contains {:status :error})
      (provided
       (aws/auto-scaling-group-instances "asg" "environment" "region") =throws=> (ex-info "Busted" {})))

(fact "that after the default maximum number of attempts we give up checking health and getting no instances"
      (wait-for-instances-to-be-healthy {:attempt 50 :parameters wait-for-instances-to-be-healthy-params})
      => (contains {:status :error})
      (provided
       (aws/auto-scaling-group-instances "asg" "environment" "region") => []))

(fact "that after the default maximum number of attempts we give up checking health and get an unsuccessful responses"
      (wait-for-instances-to-be-healthy {:attempt 50 :parameters wait-for-instances-to-be-healthy-params})
      => (contains {:status :error})
      (provided
       (aws/auto-scaling-group-instances "asg" "environment" "region") => [{:instance-id "i-1"}
                                                                           {:instance-id "i-2"}]
