Exemple #1
0
			Expect(err).To(BeNil())

			var respmap map[string]interface{}
			json.Unmarshal(resp, &respmap)
			Expect(err).To(BeNil())
			Expect(respCode).Should(Equal(http.StatusInternalServerError))
			Expect(respmap["description"]).To(Equal("no agents available"))
		})

		It("should provision a service", func() {
			brokerservice, serviceagent, ts, handler = testnet.NewBrokerServiceWithMultipleRequests(serviceagent, persister, []testnet.TestRequest{testnet.Provision_ListAllImagesRequest, testnet.Provision_CreateContainerRequest, testnet.Provision_InspectImageRequest, testnet.Provision_StartContainerRequest, testnet.Provision_InspectContainerRequest})
			defer ts.Close()

			_, b := newProvisioningRequest()

			persister.AddServiceAgents([]brokerapi.ServiceAgent{serviceagent})

			resp, respCode, err := SendHTTP("PUT", BaseURL(opts)+"/v2/service_instances/myFakeInstance", b)
			Expect(err).To(BeNil())

			var respmap map[string]interface{}
			json.Unmarshal(resp, &respmap)
			Expect(err).To(BeNil())
			Expect(respCode).Should(Equal(http.StatusCreated))
			Expect(respmap["dashboard_url"]).To(Equal("mysql://fakehost:1234"))
		})

		It("should fail to deprovision when the specific agent is not present", func() {
			brokerservice, serviceagent, ts, handler = testnet.NewBrokerServiceWithMultipleRequests(serviceagent, persister, []testnet.TestRequest{testnet.Deprovision_StopContainerRequest, testnet.Deprovision_RemoveContainerRequest})
			defer ts.Close()