| th "github.com/rackspace/gophercloud/testhelper" |
| "github.com/rackspace/gophercloud/testhelper/client" |
| func TestWaitForStatus(t *testing.T) { |
| th.Mux.HandleFunc("/servers/4321", func(w http.ResponseWriter, r *http.Request) { |
| time.Sleep(2 * time.Second) |
| w.Header().Add("Content-Type", "application/json") |
| w.WriteHeader(http.StatusOK) |
| err := WaitForStatus(client.ServiceClient(), "4321", "ACTIVE", 0) |
| t.Errorf("Expected error: 'Time Out in WaitFor'") |
| err = WaitForStatus(client.ServiceClient(), "4321", "ACTIVE", 3) |