diff --git a/cmd/serve.go b/cmd/serve.go index 4828a4ecc..5945e7dec 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -108,7 +108,8 @@ func serve() { logger.Fatal("Error initializing service broker config", err) } var serviceBroker domain.ServiceBroker - serviceBroker, err = osbapiBroker.New(cfg, storage.New(db, encryptor), logger) + csbStore := storage.New(db, encryptor) + serviceBroker, err = osbapiBroker.New(cfg, csbStore, logger) if err != nil { logger.Fatal("Error initializing service broker", err) } diff --git a/integrationtest/server_test.go b/integrationtest/server_test.go index 0c3005dbd..5606373f9 100644 --- a/integrationtest/server_test.go +++ b/integrationtest/server_test.go @@ -12,7 +12,6 @@ import ( ) var _ = Describe("Starting Server", func() { - const userProvidedPlan = `[{"name": "user-plan-unique","id":"8b52a460-b246-11eb-a8f5-d349948e2481"}]` var brokerpak string diff --git a/integrationtest/termination_recovery_test.go b/integrationtest/termination_recovery_test.go index f28f6044d..912da0d79 100644 --- a/integrationtest/termination_recovery_test.go +++ b/integrationtest/termination_recovery_test.go @@ -30,12 +30,15 @@ var _ = Describe("Recovery From Broker Termination", Ordered, func() { AfterAll(func() { os.RemoveAll("/tmp/csb/") }) + BeforeAll(func() { + brokerpak = must(packer.BuildBrokerpak(csb, fixtures("termination-recovery"))) + }) + BeforeEach(func() { + stdout = NewBuffer() + stderr = NewBuffer() + }) Describe("running csb on a VM", func() { BeforeEach(func() { - brokerpak = must(packer.BuildBrokerpak(csb, fixtures("termination-recovery"))) - - stdout = NewBuffer() - stderr = NewBuffer() broker = must(testdrive.StartBroker(csb, brokerpak, database, testdrive.WithOutputs(stdout, stderr))) DeferCleanup(func() { @@ -91,10 +94,6 @@ var _ = Describe("Recovery From Broker Termination", Ordered, func() { }) Describe("running csb as a CF app", func() { BeforeEach(func() { - brokerpak = must(packer.BuildBrokerpak(csb, fixtures("termination-recovery"))) - - stdout = NewBuffer() - stderr = NewBuffer() broker = must(testdrive.StartBroker(csb, brokerpak, database, testdrive.WithOutputs(stdout, stderr), testdrive.WithEnv("CF_INSTANCE_GUID=dcfa061e-c0e3-4237-a805-734578347393"))) DeferCleanup(func() { diff --git a/pkg/providers/tf/deployment_manager_test.go b/pkg/providers/tf/deployment_manager_test.go index 6f3405e7a..c308371ed 100644 --- a/pkg/providers/tf/deployment_manager_test.go +++ b/pkg/providers/tf/deployment_manager_test.go @@ -204,7 +204,8 @@ var _ = Describe("DeploymentManager", func() { storedDeployment := fakeStore.StoreTerraformDeploymentArgsForCall(0) Expect(storedDeployment.LastOperationState).To(Equal("succeeded")) Expect(storedDeployment.LastOperationMessage).To(Equal("provision succeeded: apply completed successfully")) - Expect(fakeLogger.Logs()).To(BeEmpty()) + Expect(fakeLogger.Logs()).To(HaveLen(1)) + Expect(fakeLogger.Logs()[0].Message).To(Equal("broker.successfully stored state for deploymentID")) }) }) @@ -221,11 +222,12 @@ var _ = Describe("DeploymentManager", func() { Expect(storedDeployment.LastOperationType).To(Equal(existingDeployment.LastOperationType)) Expect(storedDeployment.LastOperationState).To(Equal("failed")) Expect(storedDeployment.LastOperationMessage).To(Equal("provision failed: operation failed dramatically")) - Expect(fakeLogger.Logs()).To(HaveLen(1)) + Expect(fakeLogger.Logs()).To(HaveLen(2)) Expect(fakeLogger.Logs()[0].Message).To(ContainSubstring("operation-failed")) Expect(fakeLogger.Logs()[0].Data).To(HaveKeyWithValue("error", Equal("operation failed dramatically"))) Expect(fakeLogger.Logs()[0].Data).To(HaveKeyWithValue("message", Equal("provision failed: operation failed dramatically"))) Expect(fakeLogger.Logs()[0].Data).To(HaveKeyWithValue("deploymentID", Equal(existingDeployment.ID))) + Expect(fakeLogger.Logs()[1].Message).To(Equal("broker.successfully stored state for deploymentID")) }) }) })