utils

package
v0.12.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateResource

func CreateResource(t *testing.T, obj CreateObjects)

CreateResource with fake client

func DeleteResource added in v0.12.0

func DeleteResource(t *testing.T, obj DeleteObjects)

DeleteResource deletes the obj with fake client

func UpdateResource added in v0.12.0

UpdateResource Create and update the obj and return old and new obj

Types

type CreateObjects

type CreateObjects struct {
	GVR                    schema.GroupVersionResource
	Kind                   string
	Namespace              string
	Specs                  runtime.Object
	NotifType              config.NotifType
	ExpectedWebhookPayload WebhookPayload
	ExpectedSlackMessage   SlackMessage
}

CreateObjects stores specs for creating a k8s fake object and expected Slack response

type DeleteObjects added in v0.12.0

type DeleteObjects struct {
	GVR                    schema.GroupVersionResource
	Kind                   string
	Namespace              string
	Name                   string
	Specs                  runtime.Object
	ExpectedWebhookPayload WebhookPayload
	ExpectedSlackMessage   SlackMessage
}

DeleteObjects stores specs for deleting a k8s fake object

type ErrorEvent added in v0.12.0

type ErrorEvent struct {
	GVR                    schema.GroupVersionResource
	Kind                   string
	Namespace              string
	Name                   string
	Specs                  runtime.Object
	ExpectedWebhookPayload WebhookPayload
	ExpectedSlackMessage   SlackMessage
}

ErrorEvent stores specs for throwing an error in case of anomalies

type SlackMessage

type SlackMessage struct {
	Text        string
	Attachments []slack.Attachment
}

SlackMessage structure

type UpdateObjects added in v0.12.0

type UpdateObjects struct {
	GVR                    schema.GroupVersionResource
	Kind                   string
	Namespace              string
	Name                   string
	Specs                  runtime.Object
	Patch                  []byte
	Diff                   string
	UpdateSetting          config.UpdateSetting
	NotifType              config.NotifType
	ExpectedWebhookPayload WebhookPayload
	ExpectedSlackMessage   SlackMessage
}

UpdateObjects stores specs and patch for updating a k8s fake object and expected Slack response

type WebhookPayload

type WebhookPayload struct {
	Summary     string             `json:"summary"`
	EventMeta   notify.EventMeta   `json:"meta"`
	EventStatus notify.EventStatus `json:"status"`
}

WebhookPayload structure

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL