Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions internal/sentinel/sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sentinel
import (
"context"
"fmt"
"strings"
"sync"
"time"

Expand All @@ -27,7 +28,7 @@ type Sentinel struct {

mu sync.RWMutex
lastSuccessfulPoll time.Time
payloadBuilder *payload.Builder
payloadBuilder *payload.Builder
}

// NewSentinel creates a new sentinel
Expand Down Expand Up @@ -139,7 +140,7 @@ func (s *Sentinel) trigger(ctx context.Context) error {
// Create CloudEvent
event := cloudevents.NewEvent()
event.SetSpecVersion(cloudevents.VersionV1)
event.SetType(fmt.Sprintf("com.redhat.hyperfleet.%s.reconcile", resource.Kind))
event.SetType(fmt.Sprintf("com.redhat.hyperfleet.%s.reconcile", strings.ToLower(resource.Kind)))
event.SetSource("hyperfleet-sentinel")
event.SetID(uuid.New().String())
if err := event.SetData(cloudevents.ApplicationJSON, eventData); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/sentinel/sentinel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ func TestTrigger_Success(t *testing.T) {

// Verify CloudEvent properties
event := mockPublisher.publishedEvents[0]
if event.Type() != "com.redhat.hyperfleet.Cluster.reconcile" {
t.Errorf("Expected event type 'com.redhat.hyperfleet.Cluster.reconcile', got '%s'", event.Type())
if event.Type() != "com.redhat.hyperfleet.cluster.reconcile" {
t.Errorf("Expected event type 'com.redhat.hyperfleet.cluster.reconcile', got '%s'", event.Type())
}
if event.Source() != "hyperfleet-sentinel" {
t.Errorf("Expected source 'hyperfleet-sentinel', got '%s'", event.Source())
Expand Down