Documentation
¶
Index ¶
- Constants
- Variables
- func NewBalanceSnapshotEvent(in BalanceSnapshotEventInput) snapshot.SnapshotEvent
- func NewBalanceThresholdPayload() notification.EventPayload
- func NewClickhouseClient(addr string) (clickhousedriver.Conn, error)
- func NewCreateChannelInput(namespace, name string) notification.CreateChannelInput
- func NewCreateEventInput(namespace string, t notification.EventType, ruleID string, ...) notification.CreateEventInput
- func NewCreateRuleInput(namespace string, name string, channels ...string) notification.CreateRuleInput
- func NewCreateWebhookInput(namespace string, id *string, desc string) notificationwebhook.CreateWebhookInput
- func NewEntitlementResetPayload() notification.EventPayload
- func NewSvixAuthToken(signingSecret string) (string, error)
- func NewTestULID(t *testing.T) string
- 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 ( 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 ( DefaultSvixHost = "127.0.0.1" DefaultSvixJWTSigningSecret = "DUMMY_JWT_SECRET" )
Variables ¶
View Source
var ( TestEntitlementCurrentUsagePeriod = timeutil.ClosedPeriod{ From: time.Now().Add(-time.Hour), To: time.Now().Add(24 * time.Hour), } TestEntitlementUsagePeriod = entitlement.NewUsagePeriodFromRecurrence(timeutil.Recurrence{ Interval: timeutil.RecurrencePeriodDaily, Anchor: TestEntitlementCurrentUsagePeriod.From, }) TestEntitlementID = "test-entitlement-id" )
View Source
var NewTestNamespace = NewTestULID
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(namespace, name string) notification.CreateChannelInput
func NewCreateEventInput ¶
func NewCreateEventInput(namespace string, t notification.EventType, ruleID string, payload notification.EventPayload) notification.CreateEventInput
func NewCreateRuleInput ¶
func NewCreateRuleInput(namespace string, name string, channels ...string) notification.CreateRuleInput
func NewCreateWebhookInput ¶
func NewCreateWebhookInput(namespace string, id *string, desc string) notificationwebhook.CreateWebhookInput
func NewEntitlementResetPayload ¶
func NewEntitlementResetPayload() notification.EventPayload
func NewSvixAuthToken ¶
func NewTestULID ¶
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 feature.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() feature.FeatureConnector
Meter() *meteradapter.TestAdapter
Namespace() string
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.