Skip to content

Instantly share code, notes, and snippets.

@mrowe
Created February 2, 2013 00:19
Show Gist options
  • Save mrowe/4695136 to your computer and use it in GitHub Desktop.
Save mrowe/4695136 to your computer and use it in GitHub Desktop.
Long-running web service integration tests in Clojure
(deftest ^:integration instance-lifecycle
(testing "create instance"
(def result (POST "/instances" (with-principal {:name "rea-ec2-tests/int-test-micro", :instance-type "t1.micro"})))
(has-status result 200)
(let [id (first (:body result))]
(prn (str "Created instance " id))
(testing "get instance"
(has-status (GET (str "/instances/" id)) 200)
(is (wait-for-instance-state id "running")))
(testing "stop instance"
(has-status (PUT (str "/instances/" id "/stop")) 200)
(is (wait-for-instance-state id "stopped")))
(testing "start instance"
(has-status (PUT (str "/instances/" id "/start")) 200)
(is (wait-for-instance-state id "running")))
(testing "delete instance"
(has-status (DELETE (str "/instances/" id)) 200)
(is (wait-for-instance-state id "terminated"))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment