Skip to content

Commit

Permalink
Merge branch 'feat_enable_os_signal_handling' into feature_enable_dra…
Browse files Browse the repository at this point in the history
…in_and_running_on_vm
  • Loading branch information
nouseforaname committed Sep 10, 2024
2 parents 51f1ac2 + 7d80274 commit 511cca3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion integrationtest/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions integrationtest/termination_recovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion internal/testdrive/broker_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func StartBroker(csbPath, bpk, db string, opts ...StartBrokerOption) (*Broker, e
}

for {
response, err := broker.Client.Head(fmt.Sprintf("%s://localhost:%d", scheme, port))
response, err := http.Head(fmt.Sprintf("%s://localhost:%d", scheme, port))
switch {
case err == nil && response.StatusCode == http.StatusOK:
return &broker, nil
Expand Down
6 changes: 4 additions & 2 deletions pkg/providers/tf/deployment_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
})
})

Expand All @@ -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"))
})
})
})
Expand Down

0 comments on commit 511cca3

Please sign in to comment.