       wrong-md5 "2945d7de2f70de5b8c0cb3fbcba4fe92"]
   (fact "Bad content md5 throws an exception"
         (with-random-cred c
-          (do
-            (s3/create-bucket c bucket-name)
-            (s3/put-object c bucket-name object-name value
-                           {:content-md5 wrong-md5})))
+          (s3/create-bucket c bucket-name)
+          (s3/put-object c bucket-name object-name value
+                         {:content-md5 wrong-md5}))
         => (throws AmazonS3Exception)))
 
 (def bad-canonical-id

      value "this is the value!"
      as-bytes (.getBytes value "UTF-8")
      md5-sum (md5-string as-bytes)]
  (fact "check that the etag of the response
        is the same as the md5 of the original
        object"
        (with-random-cred c
          (do (s3/create-bucket c bucket-name)
            (s3/put-object c bucket-name object-name
                           value)
            ((comp :etag :metadata)
               (s3/get-object
                 c bucket-name object-name))))
        => md5-sum))

(let [bucket-name (random-string)
      object-name (random-string)
      value (str "aaaaaaaaaa" "bbbbbbbbbb")
      file-name "./clj-mp-test.txt"]
  (fact "multipart upload works"
        (with-random-cred c
          (do
            (s3/create-bucket c bucket-name)
            (write-file file-name value)
            (upload-file c bucket-name object-name file-name 10)
            (let [fetched-object (s3/get-object
                                  c bucket-name object-name)]
              [((comp slurp :content) fetched-object)
               ((comp etag-suffix :etag :metadata) fetched-object)])))
        => [value, "-2"]))

(let [bucket-name (random-string)
      object-name (random-string)

  (:require [clojure.tools.logging :as log])
  (:use midje.sweet))

(def ^:internal riak-cs-host "127.0.0.1")
(def ^:internal riak-cs-host-with-protocol (str "http://" riak-cs-host))

(defn get-riak-cs-port-str
  "Try to get a TCP port number from the OS environment"
