        (http/simple-get "http://ip2:9090/the/healthcheck" {:socket-timeout 2000}) => {:status 200}))
 
 (fact "that getting an exception while attempting the healthcheck counts as a failed check"
-      (wait-for-instances-to-be-healthy {:attempt 1 :parameters wait-for-instances-to-be-healthy-params}) => {:status :retry
-                                                                                                              :backoff-ms 10000}
+      (wait-for-instances-to-be-healthy {:attempt 1 :parameters wait-for-instances-to-be-healthy-params})
+      => {:status :retry
+          :backoff-ms 10000}
       (provided
        (aws/auto-scaling-group-instances "asg" "environment" "region") => [{:instance-id "i-1"}
                                                                            {:instance-id "i-2"}]


(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}) => {:status 200}))

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

