Documentation
¶
Index ¶
- Constants
- Variables
- func NewBalanceSnapshotEvent(in BalanceSnapshotEventInput) snapshot.SnapshotEvent
- func NewBalanceThresholdPayload() notification.EventPayload
- func NewClickhouseClient(addr string) (clickhousedriver.Conn, error)
- func NewCreateChannelInput(name string) notification.CreateChannelInput
- func NewCreateEventInput(t notification.EventType, ruleID string, payload notification.EventPayload) notification.CreateEventInput
- func NewCreateRuleInput(name string, channels ...string) notification.CreateRuleInput
- func NewCreateWebhookInput(id *string, desc string) notificationwebhook.CreateWebhookInput
- func NewMeterRepository() meter.Repository
- func NewSvixAuthToken(signingSecret string) (string, error)
- type BalanceNotificaiontHandlerTestSuite
- type BalanceSnapshotEventInput
- type ChannelTestSuite
- func (s *ChannelTestSuite) TestCreate(ctx context.Context, t *testing.T)
- func (s *ChannelTestSuite) TestDelete(ctx context.Context, t *testing.T)
- func (s *ChannelTestSuite) TestGet(ctx context.Context, t *testing.T)
- func (s *ChannelTestSuite) TestList(ctx context.Context, t *testing.T)
- func (s *ChannelTestSuite) TestUpdate(ctx context.Context, t *testing.T)
- type EventTestSuite
- func (s *EventTestSuite) Setup(ctx context.Context, t *testing.T)
- func (s *EventTestSuite) TestCreateEvent(ctx context.Context, t *testing.T)
- func (s *EventTestSuite) TestGetEvent(ctx context.Context, t *testing.T)
- func (s *EventTestSuite) TestListDeliveryStatus(ctx context.Context, t *testing.T)
- func (s *EventTestSuite) TestListEvents(ctx context.Context, t *testing.T)
- func (s *EventTestSuite) TestUpdateDeliveryStatus(ctx context.Context, t *testing.T)
- type RepositoryTestSuite
- type RuleTestSuite
- func (s *RuleTestSuite) Setup(ctx context.Context, t *testing.T)
- func (s *RuleTestSuite) TestCreate(ctx context.Context, t *testing.T)
- func (s *RuleTestSuite) TestDelete(ctx context.Context, t *testing.T)
- func (s *RuleTestSuite) TestGet(ctx context.Context, t *testing.T)
- func (s *RuleTestSuite) TestList(ctx context.Context, t *testing.T)
- func (s *RuleTestSuite) TestUpdate(ctx context.Context, t *testing.T)
- type TestEnv
- type WebhookTestSuite
- func (s *WebhookTestSuite) Setup(ctx context.Context, t *testing.T)
- func (s *WebhookTestSuite) TestCreateWebhook(ctx context.Context, t *testing.T)
- func (s *WebhookTestSuite) TestDeleteWebhook(ctx context.Context, t *testing.T)
- func (s *WebhookTestSuite) TestGetWebhook(ctx context.Context, t *testing.T)
- func (s *WebhookTestSuite) TestListWebhook(ctx context.Context, t *testing.T)
- func (s *WebhookTestSuite) TestUpdateWebhook(ctx context.Context, t *testing.T)
Constants ¶
View Source
const ( TestFeature2Name = "TestFeature2" TestFeature2Key = "test-feature-2" TestFeature3Name = "TestFeature3" TestFeature3Key = "test-feature-3" )
View Source
const ( TestNamespace = "default" TestMeterSlug = "api-call" TestFeatureName = "API Requests" TestFeatureKey = "api-call" TestFeatureID = "api-call-id" TestSubjectKey = "john-doe" TestSubjectID = "john-doe-id" // TestWebhookURL is the target URL where the notifications are sent to. // Use the following URL to verify notifications events sent over webhook channel: // https://play.svix.com/view/e_eyihAQHBB5d6T9ck1iYevP825pg TestWebhookURL = "https://play.svix.com/in/e_eyihAQHBB5d6T9ck1iYevP825pg/" // TestSigningSecret used for verifying events sent to webhook. TestSigningSecret = "whsec_Fk5kgr5qTdPdQIDniFv+6K0WN2bUpdGjjGtaNeAx8N8=" PostgresURLTemplate = "postgres://postgres:postgres@%s:5432/postgres?sslmode=disable" SvixServerURLTemplate = "http://%s:8071" )
View Source
const ( DefaultPostgresHost = "127.0.0.1" DefaultSvixHost = "127.0.0.1" DefaultSvixJWTSigningSecret = "" /* 231-byte string literal not displayed */ )
Variables ¶
View Source
var ( TestEntitlementCurrentUsagePeriod = recurrence.Period{ From: time.Now().Add(-time.Hour), To: time.Now().Add(24 * time.Hour), } TestEntitlementUsagePeriod = entitlement.UsagePeriod{ Interval: recurrence.RecurrencePeriodDaily, Anchor: TestEntitlementCurrentUsagePeriod.From, } TestEntitlementID = "test-entitlement-id" )
Functions ¶
func NewBalanceSnapshotEvent ¶
func NewBalanceSnapshotEvent(in BalanceSnapshotEventInput) snapshot.SnapshotEvent
func NewBalanceThresholdPayload ¶
func NewBalanceThresholdPayload() notification.EventPayload
func NewClickhouseClient ¶
func NewClickhouseClient(addr string) (clickhousedriver.Conn, error)
func NewCreateChannelInput ¶
func NewCreateChannelInput(name string) notification.CreateChannelInput
func NewCreateEventInput ¶
func NewCreateEventInput(t notification.EventType, ruleID string, payload notification.EventPayload) notification.CreateEventInput
func NewCreateRuleInput ¶
func NewCreateRuleInput(name string, channels ...string) notification.CreateRuleInput
func NewCreateWebhookInput ¶
func NewCreateWebhookInput(id *string, desc string) notificationwebhook.CreateWebhookInput
func NewMeterRepository ¶
func NewMeterRepository() meter.Repository
func NewSvixAuthToken ¶
Types ¶
type BalanceNotificaiontHandlerTestSuite ¶
type BalanceNotificaiontHandlerTestSuite struct { Env TestEnv // contains filtered or unexported fields }
func (*BalanceNotificaiontHandlerTestSuite) TestFeatureFiltering ¶
func (s *BalanceNotificaiontHandlerTestSuite) TestFeatureFiltering(ctx context.Context, t *testing.T)
func (*BalanceNotificaiontHandlerTestSuite) TestGrantingFlow ¶
func (s *BalanceNotificaiontHandlerTestSuite) TestGrantingFlow(ctx context.Context, t *testing.T)
type BalanceSnapshotEventInput ¶
type BalanceSnapshotEventInput struct { Feature productcatalog.Feature Value snapshot.EntitlementValue Namespace string }
type ChannelTestSuite ¶
type ChannelTestSuite struct {
Env TestEnv
}
func (*ChannelTestSuite) TestCreate ¶
func (s *ChannelTestSuite) TestCreate(ctx context.Context, t *testing.T)
func (*ChannelTestSuite) TestDelete ¶
func (s *ChannelTestSuite) TestDelete(ctx context.Context, t *testing.T)
func (*ChannelTestSuite) TestGet ¶
func (s *ChannelTestSuite) TestGet(ctx context.Context, t *testing.T)
func (*ChannelTestSuite) TestList ¶
func (s *ChannelTestSuite) TestList(ctx context.Context, t *testing.T)
func (*ChannelTestSuite) TestUpdate ¶
func (s *ChannelTestSuite) TestUpdate(ctx context.Context, t *testing.T)
type EventTestSuite ¶
type EventTestSuite struct { Env TestEnv // contains filtered or unexported fields }
func (*EventTestSuite) TestCreateEvent ¶
func (s *EventTestSuite) TestCreateEvent(ctx context.Context, t *testing.T)
func (*EventTestSuite) TestGetEvent ¶
func (s *EventTestSuite) TestGetEvent(ctx context.Context, t *testing.T)
func (*EventTestSuite) TestListDeliveryStatus ¶
func (s *EventTestSuite) TestListDeliveryStatus(ctx context.Context, t *testing.T)
func (*EventTestSuite) TestListEvents ¶
func (s *EventTestSuite) TestListEvents(ctx context.Context, t *testing.T)
func (*EventTestSuite) TestUpdateDeliveryStatus ¶
func (s *EventTestSuite) TestUpdateDeliveryStatus(ctx context.Context, t *testing.T)
type RepositoryTestSuite ¶
type RepositoryTestSuite struct { Env TestEnv // contains filtered or unexported fields }
func (*RepositoryTestSuite) Setup ¶
func (s *RepositoryTestSuite) Setup(ctx context.Context, t *testing.T)
func (*RepositoryTestSuite) TestFilterEventByFeature ¶
func (s *RepositoryTestSuite) TestFilterEventByFeature(t *testing.T)
func (*RepositoryTestSuite) TestFilterEventBySubject ¶
func (s *RepositoryTestSuite) TestFilterEventBySubject(t *testing.T)
type RuleTestSuite ¶
type RuleTestSuite struct { Env TestEnv // contains filtered or unexported fields }
func (*RuleTestSuite) TestCreate ¶
func (s *RuleTestSuite) TestCreate(ctx context.Context, t *testing.T)
func (*RuleTestSuite) TestDelete ¶
func (s *RuleTestSuite) TestDelete(ctx context.Context, t *testing.T)
func (*RuleTestSuite) TestList ¶
func (s *RuleTestSuite) TestList(ctx context.Context, t *testing.T)
func (*RuleTestSuite) TestUpdate ¶
func (s *RuleTestSuite) TestUpdate(ctx context.Context, t *testing.T)
type TestEnv ¶
type TestEnv interface { NotificationRepo() notification.Repository Notification() notification.Service NotificationWebhook() notificationwebhook.Handler Feature() productcatalog.FeatureConnector Meter() meter.Repository Close() error }
type WebhookTestSuite ¶
type WebhookTestSuite struct {
Env TestEnv
}
func (*WebhookTestSuite) Setup ¶
func (s *WebhookTestSuite) Setup(ctx context.Context, t *testing.T)
func (*WebhookTestSuite) TestCreateWebhook ¶
func (s *WebhookTestSuite) TestCreateWebhook(ctx context.Context, t *testing.T)
func (*WebhookTestSuite) TestDeleteWebhook ¶
func (s *WebhookTestSuite) TestDeleteWebhook(ctx context.Context, t *testing.T)
func (*WebhookTestSuite) TestGetWebhook ¶
func (s *WebhookTestSuite) TestGetWebhook(ctx context.Context, t *testing.T)
func (*WebhookTestSuite) TestListWebhook ¶
func (s *WebhookTestSuite) TestListWebhook(ctx context.Context, t *testing.T)
func (*WebhookTestSuite) TestUpdateWebhook ¶
func (s *WebhookTestSuite) TestUpdateWebhook(ctx context.Context, t *testing.T)
Click to show internal directories.
Click to hide internal directories.