Beispiel #1
0
				err = json.NewEncoder(stdin).Encode(&outRequest)
				Ω(err).ShouldNot(HaveOccurred())
			})

			AfterEach(func() {
				err := s3client.DeleteFile(bucketName, filepath.Join(directoryPrefix, "glob-file-to-upload"))
				Ω(err).ShouldNot(HaveOccurred())
			})

			It("uploads the file to the correct bucket and outputs the version", func() {
				s3files, err := s3client.BucketFiles(bucketName, directoryPrefix)
				Ω(err).ShouldNot(HaveOccurred())

				Ω(s3files).Should(ConsistOf(filepath.Join(directoryPrefix, "glob-file-to-upload")))

				reader := bytes.NewBuffer(session.Buffer().Contents())

				var response out.OutResponse
				err = json.NewDecoder(reader).Decode(&response)
				Ω(err).ShouldNot(HaveOccurred())

				Ω(response).Should(Equal(out.OutResponse{
					Version: s3resource.Version{
						Path: filepath.Join(directoryPrefix, "glob-file-to-upload"),
					},
					Metadata: []s3resource.MetadataPair{
						{
							Name:  "filename",
							Value: "glob-file-to-upload",
						},
						{
var _ = Describe("processmonitor cmd", func() {
	Describe("Log output", func() {
		var monitorSession *gexec.Session
		processMonitorPath := helpers.BuildExecutable(sourcePath)

		Context("When there are no Redis instances provisioned", func() {
			BeforeEach(func() {
				monitorSession = integration.LaunchProcessWithBrokerConfig(processMonitorPath, "broker.yml")
			})

			AfterEach(func() {
				helpers.KillProcess(monitorSession)
			})

			It("logs 0 instances found", func() {
				Eventually(monitorSession.Buffer()).Should(gbytes.Say("0 shared Redis instances found"))
			})
		})

		Context("When there is a single Redis instance provisioned", func() {
			instanceUuid := uuid.NewRandom().String()

			BeforeEach(func() {
				statusCode, _ := brokerClient.ProvisionInstance(instanceUuid, "shared")
				Expect(statusCode).To(Equal(201))
				monitorSession = integration.LaunchProcessWithBrokerConfig(processMonitorPath, "broker.yml")
			})

			AfterEach(func() {
				helpers.KillProcess(monitorSession)
				statusCode, _ := brokerClient.DeprovisionInstance(instanceUuid)