Created
February 2, 2013 00:19
-
-
Save mrowe/4695136 to your computer and use it in GitHub Desktop.
Long-running web service integration tests in Clojure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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