Skip to content

Commit 4e5b05a

Browse files
committed
fix ci
1 parent 7a821cf commit 4e5b05a

9 files changed

Lines changed: 129 additions & 126 deletions

File tree

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ linters:
6868
- linters:
6969
- goconst
7070
path: (.+)_test\.go
71+
- linters:
72+
- funlen
73+
- gocyclo
74+
path: (.+)_test\.go
7175
paths:
7276
- third_party$
7377
- builtin$

internal/runtime/cloudevents/event_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func TestGetExtensionBool(t *testing.T) {
172172
func TestGetExtensionTime(t *testing.T) {
173173
evt := New("test.event", "test-source", nil)
174174
testTime := time.Now().UTC()
175-
175+
176176
// Test with time.Time
177177
evt.Extensions["time_key"] = testTime
178178
value := evt.GetExtensionTime("time_key")
@@ -304,7 +304,7 @@ func TestEventClone(t *testing.T) {
304304
func TestEventMarshalJSON(t *testing.T) {
305305
subject := "test-subject"
306306
contentType := "application/json"
307-
307+
308308
evt := Event{
309309
SpecVersion: SpecVersion,
310310
Type: "test.event",
@@ -377,7 +377,7 @@ func TestEventUnmarshalJSON_MissingRequired(t *testing.T) {
377377
err := evt.UnmarshalJSON([]byte(jsonData))
378378
// UnmarshalJSON doesn't validate required fields, so no error
379379
assert.NoError(t, err)
380-
380+
381381
// But Validate should catch missing required fields
382382
err = evt.Validate()
383383
assert.Error(t, err)
@@ -386,7 +386,7 @@ func TestEventUnmarshalJSON_MissingRequired(t *testing.T) {
386386
func TestEventRoundTrip(t *testing.T) {
387387
subject := "test-subject"
388388
contentType := "application/json"
389-
389+
390390
original := Event{
391391
SpecVersion: SpecVersion,
392392
Type: "test.event",

internal/runtime/cloudevents/time_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ func TestFormatTime_NonUTC(t *testing.T) {
113113
require.NoError(t, err)
114114
testTime := time.Date(2024, 1, 1, 12, 30, 45, 0, loc)
115115
formatted := FormatTime(testTime)
116-
116+
117117
// Should be in UTC
118118
assert.Contains(t, formatted, "Z")
119-
119+
120120
// Parse it back to verify
121121
parsed, err := time.Parse(time.RFC3339, formatted)
122122
require.NoError(t, err)

internal/runtime/handlers/context_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ func TestMessageContextBase_Get(t *testing.T) {
1616
"key1": "value1",
1717
"key2": "value2",
1818
}
19-
19+
2020
logger := loggingpkg.NewSlogServiceLogger(slog.New(slog.NewTextHandler(io.Discard, nil)))
21-
21+
2222
ctx := MessageContextBase{
2323
Metadata: metadata,
2424
Logger: logger,
2525
}
26-
26+
2727
assert.Equal(t, "value1", ctx.Get("key1"))
2828
assert.Equal(t, "value2", ctx.Get("key2"))
2929
assert.Equal(t, "", ctx.Get("nonexistent"))
@@ -48,9 +48,9 @@ func TestMessageContextBase_CorrelationID(t *testing.T) {
4848
want: "",
4949
},
5050
}
51-
51+
5252
logger := loggingpkg.NewSlogServiceLogger(slog.New(slog.NewTextHandler(io.Discard, nil)))
53-
53+
5454
for _, tt := range tests {
5555
t.Run(tt.name, func(t *testing.T) {
5656
ctx := MessageContextBase{
@@ -67,24 +67,24 @@ func TestMessageContextBase_CloneMetadata(t *testing.T) {
6767
"key1": "value1",
6868
"key2": "value2",
6969
}
70-
70+
7171
logger := loggingpkg.NewSlogServiceLogger(slog.New(slog.NewTextHandler(io.Discard, nil)))
72-
72+
7373
ctx := MessageContextBase{
7474
Metadata: original,
7575
Logger: logger,
7676
}
77-
77+
7878
cloned := ctx.CloneMetadata()
79-
79+
8080
// Verify clone has same values
8181
assert.Equal(t, "value1", cloned["key1"])
8282
assert.Equal(t, "value2", cloned["key2"])
83-
83+
8484
// Modify clone
8585
cloned["key1"] = "modified"
8686
cloned["key3"] = "new"
87-
87+
8888
// Verify original is unchanged
8989
assert.Equal(t, "value1", ctx.Metadata["key1"])
9090
assert.Equal(t, "", ctx.Metadata["key3"])

internal/runtime/service_test.go

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/stretchr/testify/require"
1211
"github.com/ThreeDotsLabs/watermill"
1312
"github.com/ThreeDotsLabs/watermill-amqp/v3/pkg/amqp"
1413
"github.com/ThreeDotsLabs/watermill-aws/sns"
@@ -567,58 +566,58 @@ func TestGetErrorClassifier_NilClassifier(t *testing.T) {
567566
}
568567

569568
func TestService_Publish(t *testing.T) {
570-
t.Run("nil service", func(t *testing.T) {
571-
var svc *Service
572-
err := svc.Publish(context.Background(), "test.topic", nil)
573-
if err == nil {
574-
t.Fatal("expected error for nil service")
575-
}
576-
})
569+
t.Run("nil service", func(t *testing.T) {
570+
var svc *Service
571+
err := svc.Publish(context.Background(), "test.topic", nil)
572+
if err == nil {
573+
t.Fatal("expected error for nil service")
574+
}
575+
})
577576

578-
t.Run("nil publisher", func(t *testing.T) {
579-
svc := &Service{}
580-
err := svc.Publish(context.Background(), "test.topic", nil)
581-
if err == nil {
582-
t.Fatal("expected error for nil publisher")
583-
}
584-
})
577+
t.Run("nil publisher", func(t *testing.T) {
578+
svc := &Service{}
579+
err := svc.Publish(context.Background(), "test.topic", nil)
580+
if err == nil {
581+
t.Fatal("expected error for nil publisher")
582+
}
583+
})
585584

586-
t.Run("empty topic", func(t *testing.T) {
587-
svc := &Service{
588-
publisher: &testPublisher{},
589-
}
590-
err := svc.Publish(context.Background(), "", nil)
591-
if err == nil {
592-
t.Fatal("expected error for empty topic")
593-
}
594-
})
585+
t.Run("empty topic", func(t *testing.T) {
586+
svc := &Service{
587+
publisher: &testPublisher{},
588+
}
589+
err := svc.Publish(context.Background(), "", nil)
590+
if err == nil {
591+
t.Fatal("expected error for empty topic")
592+
}
593+
})
595594

596-
t.Run("successful publish", func(t *testing.T) {
597-
pub := &testPublisher{}
598-
svc := &Service{
599-
publisher: pub,
600-
}
601-
msg := message.NewMessage("test-id", []byte("test"))
602-
err := svc.Publish(context.Background(), "test.topic", msg)
603-
if err != nil {
604-
t.Fatalf("unexpected error: %v", err)
605-
}
606-
})
595+
t.Run("successful publish", func(t *testing.T) {
596+
pub := &testPublisher{}
597+
svc := &Service{
598+
publisher: pub,
599+
}
600+
msg := message.NewMessage("test-id", []byte("test"))
601+
err := svc.Publish(context.Background(), "test.topic", msg)
602+
if err != nil {
603+
t.Fatalf("unexpected error: %v", err)
604+
}
605+
})
607606

608-
t.Run("publishes with context", func(t *testing.T) {
609-
pub := &testPublisher{}
610-
svc := &Service{
611-
publisher: pub,
612-
}
613-
ctx := context.Background()
614-
msg := message.NewMessage("test-id", []byte("test"))
615-
err := svc.Publish(ctx, "test.topic", msg)
616-
if err != nil {
617-
t.Fatalf("unexpected error: %v", err)
618-
}
619-
// Message should have context set
620-
if msg.Context() == nil {
621-
t.Fatal("expected message to have context set")
622-
}
623-
})
607+
t.Run("publishes with context", func(t *testing.T) {
608+
pub := &testPublisher{}
609+
svc := &Service{
610+
publisher: pub,
611+
}
612+
ctx := context.Background()
613+
msg := message.NewMessage("test-id", []byte("test"))
614+
err := svc.Publish(ctx, "test.topic", msg)
615+
if err != nil {
616+
t.Fatalf("unexpected error: %v", err)
617+
}
618+
// Message should have context set
619+
if msg.Context() == nil {
620+
t.Fatal("expected message to have context set")
621+
}
622+
})
624623
}

internal/runtime/transport/capabilities_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ func TestGetCapabilities(t *testing.T) {
1010
// Test that GetCapabilities returns capabilities for known transports
1111
// The actual values come from the registry after the transports register themselves
1212
tests := []string{"channel", "kafka", "rabbitmq", "nats", "jetstream", "aws", "http", "io", "sqlite", "postgres"}
13-
13+
1414
for _, transportName := range tests {
1515
t.Run(transportName, func(t *testing.T) {
1616
caps := GetCapabilities(transportName)
1717
// Just verify we get capabilities back with the name set
1818
assert.NotNil(t, caps)
19-
// The transport may or may not be registered in tests,
19+
// The transport may or may not be registered in tests,
2020
// so we just check the function works
2121
})
2222
}

internal/runtime/transport/factory_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestDefaultFactory_Build_Channel(t *testing.T) {
3030
// being imported and registered via their init() functions. The factory.go file
3131
// imports all transports with _ "github.com/drblury/protoflow/transport/..."
3232
// which triggers their registration.
33-
33+
3434
factory := DefaultFactory()
3535
ctx := context.Background()
3636
cfg := &config.Config{
@@ -39,15 +39,15 @@ func TestDefaultFactory_Build_Channel(t *testing.T) {
3939
logger := testLogger()
4040

4141
transport, err := factory.Build(ctx, cfg, logger)
42-
42+
4343
// If the transport isn't registered (e.g., in minimal test environment),
4444
// this will error. That's okay - we're testing the factory interface.
4545
if err != nil {
4646
// Expected in some test environments where transports aren't registered
4747
t.Skipf("Transport not registered in test environment: %v", err)
4848
return
4949
}
50-
50+
5151
require.NoError(t, err)
5252
assert.NotNil(t, transport.Publisher)
5353
assert.NotNil(t, transport.Subscriber)

0 commit comments

Comments
 (0)