diff --git a/cp-connector/pkg/controlplane/eventmatcher.go b/cp-connector/pkg/controlplane/eventmatcher.go index 45db3c9def..57d1bdec44 100644 --- a/cp-connector/pkg/controlplane/eventmatcher.go +++ b/cp-connector/pkg/controlplane/eventmatcher.go @@ -1,10 +1,11 @@ package controlplane import ( + "strings" + "github.com/keptn/go-utils/pkg/api/models" "github.com/keptn/go-utils/pkg/common/sliceutils" "github.com/keptn/go-utils/pkg/lib/v0_2_0" - "strings" ) // EventMatcher is used to check whether an event contains is containing information diff --git a/cp-connector/pkg/controlplane/eventsource.go b/cp-connector/pkg/controlplane/eventsource.go index 5eb7ffaf4f..229646984a 100644 --- a/cp-connector/pkg/controlplane/eventsource.go +++ b/cp-connector/pkg/controlplane/eventsource.go @@ -17,6 +17,8 @@ type EventSenderKeyType struct{} var EventSenderKey = EventSenderKeyType{} +var _ EventSource = (*NATSEventSource)(nil) + type EventSender func(ce models.KeptnContextExtendedCE) error // EventUpdate wraps a new Keptn event received from the Event source diff --git a/cp-connector/pkg/controlplane/logforwarder.go b/cp-connector/pkg/controlplane/logforwarder.go index a44654344e..fd4430bdbf 100644 --- a/cp-connector/pkg/controlplane/logforwarder.go +++ b/cp-connector/pkg/controlplane/logforwarder.go @@ -17,6 +17,8 @@ type LogForwarder interface { Forward(keptnEvent models.KeptnContextExtendedCE, integrationID string) error } +var _ LogForwarder = LogForwardingHandler{} + type LogForwardingHandler struct { logApi api.LogsV1Interface logger logger.Logger diff --git a/cp-connector/pkg/controlplane/subscriptionsource.go b/cp-connector/pkg/controlplane/subscriptionsource.go index b577f92779..55d188288e 100644 --- a/cp-connector/pkg/controlplane/subscriptionsource.go +++ b/cp-connector/pkg/controlplane/subscriptionsource.go @@ -15,6 +15,9 @@ type SubscriptionSource interface { Register(integration models.Integration) (string, error) } +var _ SubscriptionSource = FixedSubscriptionSource{} +var _ SubscriptionSource = (*UniformSubscriptionSource)(nil) + // UniformSubscriptionSource represents a source for uniform subscriptions type UniformSubscriptionSource struct { uniformAPI api.UniformV1Interface @@ -97,3 +100,7 @@ func (s FixedSubscriptionSource) Start(ctx context.Context, data RegistrationDat go func() { c <- s.fixedSubscriptions }() return nil } + +func (s FixedSubscriptionSource) Register(integration models.Integration) (string, error) { + return "", nil +} diff --git a/cp-connector/pkg/controlplane/subscriptionsource_test.go b/cp-connector/pkg/controlplane/subscriptionsource_test.go index 70070a5e7f..fe389c0567 100644 --- a/cp-connector/pkg/controlplane/subscriptionsource_test.go +++ b/cp-connector/pkg/controlplane/subscriptionsource_test.go @@ -193,6 +193,14 @@ func TestFixedSubscriptionSourcer_WithNoSubscriptions(t *testing.T) { require.Equal(t, 0, len(updates)) } +func TestFixedSubscriptionSourcer_Register(t *testing.T) { + fss := NewFixedSubscriptionSource() + initialRegistrationData := RegistrationData{} + s, err := fss.Register(models.Integration(initialRegistrationData)) + require.NoError(t, err) + require.Equal(t, "", s) +} + func TestSubscriptionRegistrationSucceeds(t *testing.T) { initialRegistrationData := RegistrationData{} uniformInterface := &fake.UniformAPIMock{ diff --git a/cp-connector/pkg/nats/nats.go b/cp-connector/pkg/nats/nats.go index 3e2a53d439..3f1ffc4b72 100644 --- a/cp-connector/pkg/nats/nats.go +++ b/cp-connector/pkg/nats/nats.go @@ -4,12 +4,15 @@ import ( "encoding/json" "errors" "fmt" + "os" + "github.com/keptn/go-utils/pkg/api/models" "github.com/keptn/keptn/cp-connector/pkg/logger" "github.com/nats-io/nats.go" - "os" ) +var _ NATS = (*NatsConnector)(nil) + const ( EnvVarNatsURL = "NATS_URL" EnvVarNatsURLDefault = "nats://keptn-nats"