        (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})
+      (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") => []))
 

       (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}
      (provided
       (aws/auto-scaling-group-instances "asg" "environment" "region") => [{:instance-id "i-1"}
                                                                           {:instance-id "i-2"}]

                           :deployment-params {:min 2}}}})

(fact "that healthchecks are skipped if told to"
      (wait-for-instances-to-be-healthy {:attempt 1 :parameters (assoc-in wait-for-instances-to-be-healthy-params [:new-state :tyranitar :application-properties :service.healthcheck.skip] true)})
      => (contains {:status :success}))

(fact "that checking the health when min is zero skips the process"
      (wait-for-instances-to-be-healthy {:attempt 1 :parameters (assoc-in wait-for-instances-to-be-healthy-params [:new-state :tyranitar :deployment-params :min] 0)})
      => (contains {:status :success}))

(fact "that getting no instances back when min is greater than zero retries"
      (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") => []))

(fact "that getting one healthy instance when the minimum is two retries"
      (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"}]
