fakeServer.getIncidentCallCount++
			writer.Write([]byte(fakeServer.GETResponses[0]))
			if len(fakeServer.GETResponses) > 1 {
				fakeServer.GETResponses = fakeServer.GETResponses[1:]
			}
		}
	}))

	fakeServer.URL = server.URL
	return fakeServer
}

var _ = Describe("Client", func() {
	Describe("KillIndices", func() {
		var fakeServer *fakeTurbulenceServer
		var client turbulence.Client

		BeforeEach(func() {
			fakeServer = NewFakeTurbulenceServer()
			client = turbulence.NewClient(fakeServer.URL, 100*time.Millisecond, 40*time.Millisecond)
		})

		It("makes a POST request to create an incident and then polls to wait for completion", func() {
			errorKillingIndices := client.KillIndices("deployment-name", "job-name", []int{0})

			Expect(fakeServer.errorReadingBody).NotTo(HaveOccurred())
			Expect(errorKillingIndices).NotTo(HaveOccurred())
			Expect(string(fakeServer.receivedPOSTBody)).To(MatchJSON(expectedPOSTRequest))
		})

		It("returns a timeout error when execution does not complete", func() {
	"github.com/pivotal-cf-experimental/bosh-test/bosh"
	"github.com/pivotal-cf-experimental/destiny/consul"
	"github.com/pivotal-cf-experimental/destiny/turbulence"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	turbulenceclient "github.com/pivotal-cf-experimental/bosh-test/turbulence"
)

var _ = Describe("KillVm", func() {
	var (
		turbulenceClient   turbulenceclient.Client
		turbulenceManifest turbulence.Manifest
		consulManifest     consul.ManifestV2
		kv                 consulclient.HTTPKV

		spammer   *helpers.Spammer
		testKey   string
		testValue string
	)

	BeforeEach(func() {
		By("deploying turbulence", func() {
			var err error
			turbulenceManifest, err = helpers.DeployTurbulence(boshClient, config)
			Expect(err).NotTo(HaveOccurred())

			Eventually(func() ([]bosh.VM, error) {
				return helpers.DeploymentVMs(boshClient, turbulenceManifest.Name)
			}, "1m", "10s").Should(ConsistOf(helpers.GetTurbulenceVMsFromManifest(turbulenceManifest)))
	"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/consulclient"
	"github.com/cloudfoundry-incubator/consul-release/src/acceptance-tests/testing/helpers"
	"github.com/pivotal-cf-experimental/bosh-test/bosh"
	"github.com/pivotal-cf-experimental/destiny/consul"
	"github.com/pivotal-cf-experimental/destiny/turbulence"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	turbulenceclient "github.com/pivotal-cf-experimental/bosh-test/turbulence"
)

var _ = Describe("quorum loss", func() {
	var (
		turbulenceClient   turbulenceclient.Client
		turbulenceManifest turbulence.Manifest
		consulManifest     consul.ManifestV2
		kv                 consulclient.HTTPKV
	)

	BeforeEach(func() {
		By("deploying turbulence", func() {
			var err error
			turbulenceManifest, err = helpers.DeployTurbulence(boshClient, config)
			Expect(err).NotTo(HaveOccurred())

			Eventually(func() ([]bosh.VM, error) {
				return helpers.DeploymentVMs(boshClient, turbulenceManifest.Name)
			}, "1m", "10s").Should(ConsistOf(helpers.GetTurbulenceVMsFromManifest(turbulenceManifest)))

			turbulenceClient = helpers.NewTurbulenceClient(turbulenceManifest)
		})
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	turbulenceclient "github.com/pivotal-cf-experimental/bosh-test/turbulence"
)

const (
	DELAY   = 10 * time.Second
	TIMEOUT = 30 * time.Second
)

var _ = Describe("recursor timeout", func() {
	var (
		turbulenceClient   turbulenceclient.Client
		turbulenceManifest turbulence.Manifest
		consulManifest     consul.ManifestV2
		delayIncidentID    string
		tcClient           testconsumerclient.Client
	)

	BeforeEach(func() {
		By("deploying turbulence", func() {
			var err error
			turbulenceManifest, err = helpers.DeployTurbulence(boshClient, config)
			Expect(err).NotTo(HaveOccurred())

			Eventually(func() ([]bosh.VM, error) {
				return helpers.DeploymentVMs(boshClient, turbulenceManifest.Name)
			}, "1m", "10s").Should(ConsistOf(helpers.GetTurbulenceVMsFromManifest(turbulenceManifest)))

			turbulenceClient = helpers.NewTurbulenceClient(turbulenceManifest)