-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert nested binding credentials to JSON (#264)
Convert nested binding credentials to JSON (#256) Signed-off-by: Johannes Dillmann <[email protected]> Signed-off-by: Pavel Busko <[email protected]> Signed-off-by: Ralf Pannemans <[email protected]> Co-authored-by: Johannes Dillmann <[email protected]> Co-authored-by: Pavel Busko <[email protected]> Co-authored-by: Johannes Dillmann <[email protected]>
- Loading branch information
1 parent
9021dcf
commit d171940
Showing
3 changed files
with
127 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,12 +50,38 @@ func testPlatform(t *testing.T, context spec.G, it spec.S) { | |
bindings, err := libcnb.NewBindingsForBuild("") | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
Expect(bindings).To(HaveLen(2)) | ||
|
||
types := []string{bindings[0].Type, bindings[1].Type} | ||
Expect(types).To(ContainElements("elephantsql-type", "sendgrid-type")) | ||
providers := []string{bindings[0].Provider, bindings[1].Provider} | ||
Expect(providers).To(ContainElements("elephantsql-provider", "sendgrid-provider")) | ||
Expect(bindings).To(ConsistOf(libcnb.Bindings{ | ||
{ | ||
Name: "elephantsql-binding-c6c60", | ||
Type: "elephantsql-type", | ||
Provider: "elephantsql-provider", | ||
Secret: map[string]string{ | ||
"bool": "true", | ||
"int": "1", | ||
"uri": "postgres://exampleuser:[email protected]:5432/exampleuser", | ||
}, | ||
}, | ||
{ | ||
Name: "mysendgrid", | ||
Type: "sendgrid-type", | ||
Provider: "sendgrid-provider", | ||
Secret: map[string]string{ | ||
"username": "QvsXMbJ3rK", | ||
"password": "HCHMOYluTv", | ||
"hostname": "smtp.example.com", | ||
}, | ||
}, | ||
{ | ||
Name: "postgres", | ||
Type: "postgres", | ||
Provider: "postgres", | ||
Secret: map[string]string{ | ||
"urls": "{\"example\":\"http://example.com\"}", | ||
"username": "foo", | ||
"password": "bar", | ||
}, | ||
}, | ||
})) | ||
}) | ||
|
||
it("creates empty bindings from empty VCAP_SERVICES", func() { | ||
|
@@ -77,9 +103,9 @@ func testPlatform(t *testing.T, context spec.G, it spec.S) { | |
bindings, err := libcnb.NewBindingsForLaunch() | ||
Expect(err).NotTo(HaveOccurred()) | ||
|
||
Expect(bindings).To(HaveLen(2)) | ||
types := []string{bindings[0].Type, bindings[1].Type} | ||
Expect(types).To(ContainElements("elephantsql-type", "sendgrid-type")) | ||
Expect(bindings).To(HaveLen(3)) | ||
types := []string{bindings[0].Type, bindings[1].Type, bindings[2].Type} | ||
Expect(types).To(ContainElements("elephantsql-type", "sendgrid-type", "postgres")) | ||
}) | ||
|
||
it("creates empty bindings from empty VCAP_SERVICES", func() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,68 @@ | ||
{ | ||
"elephantsql-provider": [ | ||
{ | ||
"name": "elephantsql-binding-c6c60", | ||
"binding_guid": "44ceb72f-100b-4f50-87a2-7809c8b42b8d", | ||
"binding_name": "elephantsql-binding-c6c60", | ||
"instance_guid": "391308e8-8586-4c42-b464-c7831aa2ad22", | ||
"instance_name": "elephantsql-c6c60", | ||
"label": "elephantsql-type", | ||
"tags": [ | ||
"postgres", | ||
"postgresql", | ||
"relational" | ||
], | ||
"plan": "turtle", | ||
"credentials": { | ||
"uri": "postgres://exampleuser:[email protected]:5432/exampleuser" | ||
}, | ||
"syslog_drain_url": null, | ||
"volume_mounts": [] | ||
} | ||
], | ||
"sendgrid-provider": [ | ||
{ | ||
"name": "mysendgrid", | ||
"binding_guid": "6533b1b6-7916-488d-b286-ca33d3fa0081", | ||
"binding_name": null, | ||
"instance_guid": "8c907d0f-ec0f-44e4-87cf-e23c9ba3925d", | ||
"instance_name": "mysendgrid", | ||
"label": "sendgrid-type", | ||
"tags": [ | ||
"smtp" | ||
], | ||
"plan": "free", | ||
"credentials": { | ||
"hostname": "smtp.example.com", | ||
"username": "QvsXMbJ3rK", | ||
"password": "HCHMOYluTv" | ||
}, | ||
"syslog_drain_url": null, | ||
"volume_mounts": [] | ||
} | ||
] | ||
} | ||
"elephantsql-provider": [ | ||
{ | ||
"name": "elephantsql-binding-c6c60", | ||
"binding_guid": "44ceb72f-100b-4f50-87a2-7809c8b42b8d", | ||
"binding_name": "elephantsql-binding-c6c60", | ||
"instance_guid": "391308e8-8586-4c42-b464-c7831aa2ad22", | ||
"instance_name": "elephantsql-c6c60", | ||
"label": "elephantsql-type", | ||
"tags": [ | ||
"postgres", | ||
"postgresql", | ||
"relational" | ||
], | ||
"plan": "turtle", | ||
"credentials": { | ||
"uri": "postgres://exampleuser:[email protected]:5432/exampleuser", | ||
"int": 1, | ||
"bool": true | ||
}, | ||
"syslog_drain_url": null, | ||
"volume_mounts": [] | ||
} | ||
], | ||
"sendgrid-provider": [ | ||
{ | ||
"name": "mysendgrid", | ||
"binding_guid": "6533b1b6-7916-488d-b286-ca33d3fa0081", | ||
"binding_name": null, | ||
"instance_guid": "8c907d0f-ec0f-44e4-87cf-e23c9ba3925d", | ||
"instance_name": "mysendgrid", | ||
"label": "sendgrid-type", | ||
"tags": [ | ||
"smtp" | ||
], | ||
"plan": "free", | ||
"credentials": { | ||
"hostname": "smtp.example.com", | ||
"username": "QvsXMbJ3rK", | ||
"password": "HCHMOYluTv" | ||
}, | ||
"syslog_drain_url": null, | ||
"volume_mounts": [] | ||
} | ||
], | ||
"postgres": [ | ||
{ | ||
"name": "postgres", | ||
"label": "postgres", | ||
"plan": "default", | ||
"tags": [ | ||
"postgres" | ||
], | ||
"binding_guid": "6533b1b6-7916-488d-b286-ca33d3fa0081", | ||
"binding_name": null, | ||
"instance_guid": "8c907d0f-ec0f-44e4-87cf-e23c9ba3925d", | ||
"credentials": { | ||
"username": "foo", | ||
"password": "bar", | ||
"urls": { | ||
"example": "http://example.com" | ||
} | ||
}, | ||
"syslog_drain_url": null, | ||
"volume_mounts": [] | ||
} | ||
] | ||
} |