Documentation ¶
Index ¶
- func CreateSecret(key string, opts ...SecretOptFunc) *corev1.Secret
- func MakeHookFromFixture(t *testing.T, filename, eventType string) scm.Webhook
- func MakeHookRequest(t *testing.T, fixture, eventType string, changes ...fixtureFunc) *http.Request
- func MatchError(t *testing.T, s string, e error) bool
- func ReadJSONFixture(t *testing.T, filename string) map[string]interface{}
- func UnmarshalJSON(t *testing.T, b []byte) map[string]interface{}
- type SecretOptFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSecret ¶
func CreateSecret(key string, opts ...SecretOptFunc) *corev1.Secret
CreateSecret creates and returns a new Secret with the provided key in the data.
A slice of SecretOptFuncs can be used to modify the returned secret.
func MakeHookFromFixture ¶
MakeHookFromFixture creates and returns a WebHook parsed from the provided fixture file, with the correct X-GitHub-Event type etc.
func MakeHookRequest ¶
MakeHookRequest creates and returns a new http.Request that resembles a GitHub hook request, including the correct event type and reading and sending a fixture as a JSON body.
Optionally changes can be applied to the fixture that is read, before it's sent. TODO use uuid to generate the Delivery ID.
func MatchError ¶
MatchError checks errors against a regexp.
Returns true if the string is empty and the error is nil. Returns false if the string is not empty and the error is nil. Otherwise returns the result of a regexp match against the string.
func ReadJSONFixture ¶
ReadJSONFixture reads a filename into a map, and fails the test if it is unable to open or parse the file.