-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup; rename package, secret reader
- Loading branch information
1 parent
a423807
commit 2110375
Showing
10 changed files
with
189 additions
and
186 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package servicebindings | ||
|
||
import "bytes" | ||
|
||
// Entry represents the read-only content of a binding entry. | ||
type Entry struct { | ||
data *bytes.Buffer | ||
} | ||
|
||
// MakeEntry returns an Entry from the given content. | ||
func MakeEntry(data []byte) Entry { | ||
return Entry{ | ||
data: bytes.NewBuffer(data), | ||
} | ||
} | ||
|
||
// Bytes returns the raw content of the entry. | ||
func (e Entry) Bytes() []byte { | ||
return e.data.Bytes() | ||
} | ||
|
||
// String returns the content of the entry as a string. | ||
func (e Entry) String() string { | ||
return e.data.String() | ||
} | ||
|
||
// Read reads the next len(p) bytes from the entry or until the entry is drained. The return value n is the number of | ||
// bytes read. If the entry has no data to return, err is io.EOF (unless len(p) is zero); otherwise it is nil. | ||
func (e Entry) Read(p []byte) (int, error) { | ||
return e.data.Read(p) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package servicebindings_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/sclevine/spec" | ||
"github.com/sclevine/spec/report" | ||
) | ||
|
||
func TestUnitServiceBindings(t *testing.T) { | ||
suite := spec.New("packit/servicebindings", spec.Report(report.Terminal{})) | ||
suite("Resolver", testResolver) | ||
suite("Entry", testEntry) | ||
suite.Run(t) | ||
} |
Oops, something went wrong.