diff --git a/aggregate_test.go b/aggregate_test.go index 20ca869a..b4a0c1a8 100644 --- a/aggregate_test.go +++ b/aggregate_test.go @@ -23,6 +23,8 @@ import ( ) func TestCreateAggregate(t *testing.T) { + t.Parallel() + id := uuid.New() _, err := CreateAggregate(TestAggregateRegisterType, id) if !errors.Is(err, ErrAggregateNotRegistered) { @@ -47,6 +49,8 @@ func TestCreateAggregate(t *testing.T) { } func TestRegisterAggregateEmptyName(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: attempt to register empty aggregate type" { t.Error("there should have been a panic:", r) @@ -58,6 +62,8 @@ func TestRegisterAggregateEmptyName(t *testing.T) { } func TestRegisterAggregateNil(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: created aggregate is nil" { t.Error("there should have been a panic:", r) @@ -67,6 +73,8 @@ func TestRegisterAggregateNil(t *testing.T) { } func TestRegisterAggregateTwice(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: registering duplicate types for \"TestAggregateRegisterTwice\"" { t.Error("there should have been a panic:", r) diff --git a/aggregatestore/events/aggregatebase_test.go b/aggregatestore/events/aggregatebase_test.go index bf4a6707..10e2083b 100644 --- a/aggregatestore/events/aggregatebase_test.go +++ b/aggregatestore/events/aggregatebase_test.go @@ -25,6 +25,8 @@ import ( ) func TestNewAggregateBase(t *testing.T) { + t.Parallel() + id := uuid.New() agg := NewAggregateBase(TestAggregateType, id) if agg == nil { @@ -42,6 +44,8 @@ func TestNewAggregateBase(t *testing.T) { } func TestAggregateVersion(t *testing.T) { + t.Parallel() + agg := NewAggregateBase(TestAggregateType, uuid.New()) if agg.AggregateVersion() != 0 { t.Error("the version should be 0:", agg.AggregateVersion()) @@ -54,6 +58,8 @@ func TestAggregateVersion(t *testing.T) { } func TestAggregateEvents(t *testing.T) { + t.Parallel() + id := uuid.New() agg := NewTestAggregate(id) timestamp := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) diff --git a/aggregatestore/events/aggregatestore_test.go b/aggregatestore/events/aggregatestore_test.go index 4cd16f43..bf6d9bc4 100644 --- a/aggregatestore/events/aggregatestore_test.go +++ b/aggregatestore/events/aggregatestore_test.go @@ -27,6 +27,8 @@ import ( ) func TestNewAggregateStore(t *testing.T) { + t.Parallel() + eventStore := &mocks.EventStore{ Events: make([]eh.Event, 0), } @@ -49,6 +51,8 @@ func TestNewAggregateStore(t *testing.T) { } func TestAggregateStore_LoadNoEvents(t *testing.T) { + t.Parallel() + store, _ := createStore(t) ctx := context.Background() @@ -71,6 +75,8 @@ func TestAggregateStore_LoadNoEvents(t *testing.T) { } func TestAggregateStore_LoadEvents(t *testing.T) { + t.Parallel() + store, eventStore := createStore(t) ctx := context.Background() @@ -133,6 +139,8 @@ func TestAggregateStore_LoadEvents(t *testing.T) { } func TestAggregateStore_LoadEvents_MismatchedEventType(t *testing.T) { + t.Parallel() + store, eventStore := createStore(t) ctx := context.Background() @@ -162,6 +170,8 @@ func TestAggregateStore_LoadEvents_MismatchedEventType(t *testing.T) { } func TestAggregateStore_SaveEvents(t *testing.T) { + t.Parallel() + store, eventStore := createStore(t) ctx := context.Background() @@ -222,6 +232,8 @@ func TestAggregateStore_SaveEvents(t *testing.T) { } func TestAggregateStore_AggregateNotRegistered(t *testing.T) { + t.Parallel() + store, _ := createStore(t) ctx := context.Background() diff --git a/aggregatestore/model/aggregatestore_test.go b/aggregatestore/model/aggregatestore_test.go index af288b7c..f25a7782 100644 --- a/aggregatestore/model/aggregatestore_test.go +++ b/aggregatestore/model/aggregatestore_test.go @@ -27,6 +27,8 @@ import ( ) func TestNewAggregateStore(t *testing.T) { + t.Parallel() + repo := &mocks.Repo{} bus := &mocks.EventBus{ Events: make([]eh.Event, 0), @@ -50,6 +52,8 @@ func TestNewAggregateStore(t *testing.T) { } func TestAggregateStore_LoadNotFound(t *testing.T) { + t.Parallel() + store, repo, _ := createStore(t) ctx := context.Background() @@ -66,6 +70,8 @@ func TestAggregateStore_LoadNotFound(t *testing.T) { } func TestAggregateStore_Load(t *testing.T) { + t.Parallel() + store, repo, _ := createStore(t) ctx := context.Background() @@ -92,6 +98,8 @@ func TestAggregateStore_Load(t *testing.T) { } func TestAggregateStore_Load_InvalidAggregate(t *testing.T) { + t.Parallel() + store, repo, _ := createStore(t) ctx := context.Background() @@ -114,6 +122,8 @@ func TestAggregateStore_Load_InvalidAggregate(t *testing.T) { } func TestAggregateStore_Save(t *testing.T) { + t.Parallel() + store, repo, _ := createStore(t) ctx := context.Background() @@ -139,6 +149,8 @@ func TestAggregateStore_Save(t *testing.T) { } func TestAggregateStore_SaveWithPublish(t *testing.T) { + t.Parallel() + store, repo, bus := createStore(t) ctx := context.Background() diff --git a/codec/bson/codec_test.go b/codec/bson/codec_test.go index ec89bedf..25e8205e 100644 --- a/codec/bson/codec_test.go +++ b/codec/bson/codec_test.go @@ -22,6 +22,8 @@ import ( ) func TestEventCodec(t *testing.T) { + t.Parallel() + c := &EventCodec{} expectedBytes, err := base64.StdEncoding.DecodeString("4QEAAAJldmVudF90eXBlAAsAAABDb2RlY0V2ZW50AANkYXRhAAwBAAAIYm9vbAABAnN0cmluZwAHAAAAc3RyaW5nAAFudW1iZXIAAAAAAAAARUAEc2xpY2UAFwAAAAIwAAIAAABhAAIxAAIAAABiAAADbWFwABQAAAACa2V5AAYAAAB2YWx1ZQAACXRpbWUAgDVT4CQBAAAJdGltZXJlZgCANVPgJAEAAApudWxsdGltZQADc3RydWN0AC8AAAAIYm9vbAABAnN0cmluZwAHAAAAc3RyaW5nAAFudW1iZXIAAAAAAAAARUAAA3N0cnVjdHJlZgAvAAAACGJvb2wAAQJzdHJpbmcABwAAAHN0cmluZwABbnVtYmVyAAAAAAAAAEVAAApudWxsc3RydWN0AAAJdGltZXN0YW1wAIA1U+AkAQAAAmFnZ3JlZ2F0ZV90eXBlAAoAAABBZ2dyZWdhdGUAAl9pZAAlAAAAMTBhN2VjMGYtN2YyYi00NmY1LWJjYTEtODc3YjZlMzNjOWZkABB2ZXJzaW9uAAEAAAADbWV0YWRhdGEAEgAAAAFudW0AAAAAAAAARUAAA2NvbnRleHQAHgAAAAJjb250ZXh0X29uZQAIAAAAdGVzdHZhbAAAAA==") if err != nil { diff --git a/codec/json/codec_test.go b/codec/json/codec_test.go index 53e686e5..c687b720 100644 --- a/codec/json/codec_test.go +++ b/codec/json/codec_test.go @@ -22,6 +22,8 @@ import ( ) func TestEventCodec(t *testing.T) { + t.Parallel() + c := &EventCodec{} expectedBytes := strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(` { diff --git a/command_test.go b/command_test.go index 7f95d898..6e292899 100644 --- a/command_test.go +++ b/command_test.go @@ -22,6 +22,8 @@ import ( ) func TestCreateCommand(t *testing.T) { + t.Parallel() + _, err := CreateCommand(TestCommandRegisterType) if !errors.Is(err, ErrCommandNotRegistered) { t.Error("there should be a command not registered error:", err) @@ -39,6 +41,8 @@ func TestCreateCommand(t *testing.T) { } func TestRegisterCommandEmptyName(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: attempt to register empty command type" { t.Error("there should have been a panic:", r) @@ -48,6 +52,8 @@ func TestRegisterCommandEmptyName(t *testing.T) { } func TestRegisterCommandNil(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: created command is nil" { t.Error("there should have been a panic:", r) @@ -57,6 +63,8 @@ func TestRegisterCommandNil(t *testing.T) { } func TestRegisterCommandTwice(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: registering duplicate types for \"TestCommandRegisterTwice\"" { t.Error("there should have been a panic:", r) @@ -67,6 +75,8 @@ func TestRegisterCommandTwice(t *testing.T) { } func TestUnregisterCommandEmptyName(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: attempt to unregister empty command type" { t.Error("there should have been a panic:", r) @@ -76,6 +86,8 @@ func TestUnregisterCommandEmptyName(t *testing.T) { } func TestUnregisterCommandTwice(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: unregister of non-registered type \"TestCommandUnregisterTwice\"" { t.Error("there should have been a panic:", r) diff --git a/commandhandler/aggregate/commandhandler_test.go b/commandhandler/aggregate/commandhandler_test.go index bd7d2611..d93770dd 100644 --- a/commandhandler/aggregate/commandhandler_test.go +++ b/commandhandler/aggregate/commandhandler_test.go @@ -26,6 +26,8 @@ import ( ) func TestNewCommandHandler(t *testing.T) { + t.Parallel() + store := &mocks.AggregateStore{ Aggregates: make(map[uuid.UUID]eh.Aggregate), } @@ -47,6 +49,8 @@ func TestNewCommandHandler(t *testing.T) { } func TestCommandHandler(t *testing.T) { + t.Parallel() + a, h, _ := createAggregateAndHandler(t) ctx := context.WithValue(context.Background(), "testkey", "testval") @@ -68,6 +72,8 @@ func TestCommandHandler(t *testing.T) { } func TestCommandHandler_AggregateNotFound(t *testing.T) { + t.Parallel() + store := &mocks.AggregateStore{ Aggregates: map[uuid.UUID]eh.Aggregate{}, } @@ -90,6 +96,8 @@ func TestCommandHandler_AggregateNotFound(t *testing.T) { } func TestCommandHandler_ErrorInHandler(t *testing.T) { + t.Parallel() + a, h, _ := createAggregateAndHandler(t) commandErr := errors.New("command error") @@ -109,6 +117,8 @@ func TestCommandHandler_ErrorInHandler(t *testing.T) { } func TestCommandHandler_ErrorWhenSaving(t *testing.T) { + t.Parallel() + a, h, store := createAggregateAndHandler(t) saveErr := errors.New("save error") @@ -124,6 +134,8 @@ func TestCommandHandler_ErrorWhenSaving(t *testing.T) { } func TestCommandHandler_NoHandlers(t *testing.T) { + t.Parallel() + _, h, _ := createAggregateAndHandler(t) cmd := &mocks.Command{ diff --git a/commandhandler/bus/commandhandler_test.go b/commandhandler/bus/commandhandler_test.go index 62b5a909..529a4875 100644 --- a/commandhandler/bus/commandhandler_test.go +++ b/commandhandler/bus/commandhandler_test.go @@ -26,6 +26,8 @@ import ( ) func TestCommandHandler(t *testing.T) { + t.Parallel() + bus := NewCommandHandler() if bus == nil { t.Fatal("there should be a bus") diff --git a/context_test.go b/context_test.go index 8b8f814e..2f8811f2 100644 --- a/context_test.go +++ b/context_test.go @@ -20,6 +20,8 @@ import ( ) func TestContextMarshaler(t *testing.T) { + t.Parallel() + if len(contextMarshalFuncs) != 1 { t.Error("there should be one context marshaler") } @@ -46,6 +48,8 @@ func TestContextMarshaler(t *testing.T) { } func TestContextUnmarshaler(t *testing.T) { + t.Parallel() + if len(contextUnmarshalFuncs) != 1 { t.Error("there should be one context marshaler") } diff --git a/event_test.go b/event_test.go index 224f33fc..d8271148 100644 --- a/event_test.go +++ b/event_test.go @@ -24,6 +24,8 @@ import ( ) func TestNewEvent(t *testing.T) { + t.Parallel() + timestamp := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) event := NewEvent(TestEventType, &TestEventData{"event1"}, timestamp) if event.EventType() != TestEventType { @@ -85,6 +87,8 @@ func TestNewEvent(t *testing.T) { } func TestCreateEventData(t *testing.T) { + t.Parallel() + data, err := CreateEventData(TestEventRegisterType) if !errors.Is(err, ErrEventDataNotRegistered) { t.Error("there should be a event not registered error:", err) @@ -109,6 +113,8 @@ func TestCreateEventData(t *testing.T) { } func TestRegisterEventEmptyName(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: attempt to register empty event type" { t.Error("there should have been a panic:", r) @@ -120,6 +126,8 @@ func TestRegisterEventEmptyName(t *testing.T) { } func TestRegisterEventTwice(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: registering duplicate types for \"TestEventRegisterTwice\"" { t.Error("there should have been a panic:", r) @@ -134,6 +142,8 @@ func TestRegisterEventTwice(t *testing.T) { } func TestUnregisterEventEmptyName(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: attempt to unregister empty event type" { t.Error("there should have been a panic:", r) @@ -143,6 +153,8 @@ func TestUnregisterEventEmptyName(t *testing.T) { } func TestUnregisterEventTwice(t *testing.T) { + t.Parallel() + defer func() { if r := recover(); r == nil || r != "eventhorizon: unregister of non-registered type \"TestEventUnregisterTwice\"" { t.Error("there should have been a panic:", r) diff --git a/eventbus/local/eventbus_test.go b/eventbus/local/eventbus_test.go index 57efac85..f65128bc 100644 --- a/eventbus/local/eventbus_test.go +++ b/eventbus/local/eventbus_test.go @@ -23,9 +23,7 @@ import ( // NOTE: Not named "Integration" to enable running with the unit tests. func TestAddHandler(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } + t.Parallel() bus := NewEventBus() if bus == nil { @@ -37,6 +35,8 @@ func TestAddHandler(t *testing.T) { // NOTE: Not named "Integration" to enable running with the unit tests. func TestEventBus(t *testing.T) { + t.Parallel() + group := NewGroup() if group == nil { t.Fatal("there should be a group") diff --git a/eventbus/tracing/eventbus_test.go b/eventbus/tracing/eventbus_test.go index ca184cc8..761ecb59 100644 --- a/eventbus/tracing/eventbus_test.go +++ b/eventbus/tracing/eventbus_test.go @@ -24,9 +24,7 @@ import ( // NOTE: Not named "Integration" to enable running with the unit tests. func TestAddHandler(t *testing.T) { - if testing.Short() { - t.Skip("skipping integration test") - } + t.Parallel() innerBus := local.NewEventBus() if innerBus == nil { @@ -43,6 +41,8 @@ func TestAddHandler(t *testing.T) { // NOTE: Not named "Integration" to enable running with the unit tests. func TestEventBus(t *testing.T) { + t.Parallel() + group := local.NewGroup() if group == nil { t.Fatal("there should be a group") diff --git a/eventbus_test.go b/eventbus_test.go index 2c3d5c3d..72521cc5 100644 --- a/eventbus_test.go +++ b/eventbus_test.go @@ -21,6 +21,8 @@ import ( ) func TestEventBusError(t *testing.T) { + t.Parallel() + var testCases = []struct { name string err error @@ -55,7 +57,10 @@ func TestEventBusError(t *testing.T) { } for _, tc := range testCases { + tc := tc t.Run(tc.name, func(t *testing.T) { + t.Parallel() + busError := &EventBusError{ Err: tc.err, Event: tc.event, diff --git a/eventhandler/projector/eventhandler_test.go b/eventhandler/projector/eventhandler_test.go index a4eba76a..2036dc33 100644 --- a/eventhandler/projector/eventhandler_test.go +++ b/eventhandler/projector/eventhandler_test.go @@ -28,6 +28,8 @@ import ( ) func TestEventHandler_CreateModel(t *testing.T) { + t.Parallel() + repo := &mocks.Repo{} projector := &TestProjector{} handler := NewEventHandler(projector, repo) @@ -65,6 +67,8 @@ func TestEventHandler_CreateModel(t *testing.T) { } func TestEventHandler_UpdateModel(t *testing.T) { + t.Parallel() + repo := &mocks.Repo{} projector := &TestProjector{} handler := NewEventHandler(projector, repo) @@ -297,6 +301,8 @@ func TestEventHandler_UpdateModelWithRetryOnce(t *testing.T) { } func TestEventHandler_DeleteModel(t *testing.T) { + t.Parallel() + repo := &mocks.Repo{} projector := &TestProjector{} handler := NewEventHandler(projector, repo) @@ -412,6 +418,8 @@ func TestEventHandler_ProjectError(t *testing.T) { } func TestEventHandler_EntityLookup(t *testing.T) { + t.Parallel() + repo := &mocks.Repo{} projector := &TestProjector{} handler := NewEventHandler(projector, repo, diff --git a/eventhandler/saga/eventhandler_test.go b/eventhandler/saga/eventhandler_test.go index 60514ae1..5d4814cf 100644 --- a/eventhandler/saga/eventhandler_test.go +++ b/eventhandler/saga/eventhandler_test.go @@ -26,6 +26,8 @@ import ( ) func TestEventHandler(t *testing.T) { + t.Parallel() + commandHandler := &mocks.CommandHandler{ Commands: []eh.Command{}, } diff --git a/eventhandler/waiter/eventhandler_test.go b/eventhandler/waiter/eventhandler_test.go index c6b3f9e3..5204c174 100644 --- a/eventhandler/waiter/eventhandler_test.go +++ b/eventhandler/waiter/eventhandler_test.go @@ -28,6 +28,8 @@ import ( ) func TestEventHandler(t *testing.T) { + t.Parallel() + h := NewEventHandler() // Event should match when waiting. diff --git a/eventhandler_test.go b/eventhandler_test.go index 7a610c78..d7e6b24e 100644 --- a/eventhandler_test.go +++ b/eventhandler_test.go @@ -22,6 +22,8 @@ import ( ) func TestEventHandlerFunc(t *testing.T) { + t.Parallel() + events := []Event{} h := EventHandlerFunc(func(ctx context.Context, e Event) error { events = append(events, e) diff --git a/eventstore/memory/eventmaintenance_test.go b/eventstore/memory/eventmaintenance_test.go index 46e9b6c4..66462d0e 100644 --- a/eventstore/memory/eventmaintenance_test.go +++ b/eventstore/memory/eventmaintenance_test.go @@ -22,6 +22,8 @@ import ( ) func TestEventStoreMaintenance(t *testing.T) { + t.Parallel() + store, err := NewEventStore() if err != nil { t.Fatal("there should be no error:", err) diff --git a/eventstore/memory/eventstore_test.go b/eventstore/memory/eventstore_test.go index 9be9cc57..e696cd92 100644 --- a/eventstore/memory/eventstore_test.go +++ b/eventstore/memory/eventstore_test.go @@ -26,6 +26,8 @@ import ( ) func TestEventStore(t *testing.T) { + t.Parallel() + store, err := NewEventStore() if err != nil { t.Fatal("there should be no error:", err) @@ -38,6 +40,8 @@ func TestEventStore(t *testing.T) { } func TestWithEventHandler(t *testing.T) { + t.Parallel() + h := &mocks.EventBus{} store, err := NewEventStore(WithEventHandler(h)) diff --git a/eventstore/tracing/eventstore_test.go b/eventstore/tracing/eventstore_test.go index c3d2f3bd..76353f23 100644 --- a/eventstore/tracing/eventstore_test.go +++ b/eventstore/tracing/eventstore_test.go @@ -24,6 +24,8 @@ import ( // NOTE: Not named "Integration" to enable running with the unit tests. func TestEventStore(t *testing.T) { + t.Parallel() + innerStore, err := memory.NewEventStore() if err != nil { t.Fatal("there should be no error:", err) diff --git a/matcher_test.go b/matcher_test.go index a35eb3ac..1f7b7517 100644 --- a/matcher_test.go +++ b/matcher_test.go @@ -22,6 +22,8 @@ import ( ) func TestMatchEvents(t *testing.T) { + t.Parallel() + et := EventType("test") m := MatchEvents{et} if m.Match(nil) { @@ -55,6 +57,8 @@ func TestMatchEvents(t *testing.T) { } func TestMatchAggregates(t *testing.T) { + t.Parallel() + at := AggregateType("test") m := MatchAggregates{at} @@ -89,6 +93,8 @@ func TestMatchAggregates(t *testing.T) { } func TestMatchAny(t *testing.T) { + t.Parallel() + et := EventType("et") at := AggregateType("at") m := MatchAny{ @@ -111,6 +117,8 @@ func TestMatchAny(t *testing.T) { } func TestMatchAll(t *testing.T) { + t.Parallel() + et := EventType("et") at := AggregateType("at") m := MatchAll{ diff --git a/middleware/commandhandler/async/middleware_test.go b/middleware/commandhandler/async/middleware_test.go index 876f6ffa..5cc524ce 100644 --- a/middleware/commandhandler/async/middleware_test.go +++ b/middleware/commandhandler/async/middleware_test.go @@ -27,6 +27,8 @@ import ( ) func TestMiddleware(t *testing.T) { + t.Parallel() + cmd := mocks.Command{ ID: uuid.New(), Content: "content", diff --git a/middleware/commandhandler/lock/middleware_test.go b/middleware/commandhandler/lock/middleware_test.go index 187a56bd..bf50e51c 100644 --- a/middleware/commandhandler/lock/middleware_test.go +++ b/middleware/commandhandler/lock/middleware_test.go @@ -26,6 +26,8 @@ import ( ) func TestMiddleware(t *testing.T) { + t.Parallel() + cmd := mocks.Command{ ID: uuid.New(), Content: "content", diff --git a/middleware/commandhandler/scheduler/middleware_test.go b/middleware/commandhandler/scheduler/middleware_test.go index ee2f9320..a06985a2 100644 --- a/middleware/commandhandler/scheduler/middleware_test.go +++ b/middleware/commandhandler/scheduler/middleware_test.go @@ -27,6 +27,8 @@ import ( ) func TestMiddleware_Immediate(t *testing.T) { + t.Parallel() + inner := &mocks.CommandHandler{} m, _ := NewMiddleware() h := eh.UseCommandHandlerMiddleware(inner, m) @@ -43,6 +45,8 @@ func TestMiddleware_Immediate(t *testing.T) { } func TestMiddleware_Delayed(t *testing.T) { + t.Parallel() + inner := &mocks.CommandHandler{} m, _ := NewMiddleware() h := eh.UseCommandHandlerMiddleware(inner, m) @@ -69,6 +73,8 @@ func TestMiddleware_Delayed(t *testing.T) { } func TestMiddleware_ZeroTime(t *testing.T) { + t.Parallel() + inner := &mocks.CommandHandler{} m, _ := NewMiddleware() h := eh.UseCommandHandlerMiddleware(inner, m) @@ -86,6 +92,8 @@ func TestMiddleware_ZeroTime(t *testing.T) { } func TestMiddleware_Errors(t *testing.T) { + t.Parallel() + handlerErr := errors.New("handler error") inner := &mocks.CommandHandler{ Err: handlerErr, @@ -114,6 +122,8 @@ func TestMiddleware_Errors(t *testing.T) { } func TestMiddleware_ContextCanceled(t *testing.T) { + t.Parallel() + handlerErr := errors.New("handler error") inner := &mocks.CommandHandler{ Err: handlerErr, @@ -145,6 +155,8 @@ func TestMiddleware_ContextCanceled(t *testing.T) { } func TestMiddleware_ContextDeadline(t *testing.T) { + t.Parallel() + handlerErr := errors.New("handler error") inner := &mocks.CommandHandler{ Err: handlerErr, diff --git a/middleware/commandhandler/validate/middleware_test.go b/middleware/commandhandler/validate/middleware_test.go index e95a7019..1aa9563a 100644 --- a/middleware/commandhandler/validate/middleware_test.go +++ b/middleware/commandhandler/validate/middleware_test.go @@ -26,6 +26,8 @@ import ( ) func TestMiddleware_Immediate(t *testing.T) { + t.Parallel() + inner := &mocks.CommandHandler{} m := NewMiddleware() h := eh.UseCommandHandlerMiddleware(inner, m) @@ -42,6 +44,8 @@ func TestMiddleware_Immediate(t *testing.T) { } func TestMiddleware_WithValidationError(t *testing.T) { + t.Parallel() + inner := &mocks.CommandHandler{} m := NewMiddleware() h := eh.UseCommandHandlerMiddleware(inner, m) @@ -65,6 +69,8 @@ func TestMiddleware_WithValidationError(t *testing.T) { } func TestMiddleware_WithValidationNoError(t *testing.T) { + t.Parallel() + inner := &mocks.CommandHandler{} m := NewMiddleware() h := eh.UseCommandHandlerMiddleware(inner, m) diff --git a/middleware/eventhandler/async/middleware_test.go b/middleware/eventhandler/async/middleware_test.go index 3fd99d3c..c39a9931 100644 --- a/middleware/eventhandler/async/middleware_test.go +++ b/middleware/eventhandler/async/middleware_test.go @@ -27,6 +27,8 @@ import ( ) func TestMiddleware(t *testing.T) { + t.Parallel() + id := uuid.New() eventData := &mocks.EventData{Content: "event1"} timestamp := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) diff --git a/middleware_test.go b/middleware_test.go index 273ff6db..96a86a22 100644 --- a/middleware_test.go +++ b/middleware_test.go @@ -24,6 +24,8 @@ import ( ) func TestCommandHandlerMiddleware(t *testing.T) { + t.Parallel() + order := []string{} middleware := func(s string) CommandHandlerMiddleware { return CommandHandlerMiddleware(func(h CommandHandler) CommandHandler { @@ -57,6 +59,8 @@ func (a MiddlewareTestCommand) AggregateType() AggregateType { return "test" } func (a MiddlewareTestCommand) CommandType() CommandType { return "tes" } func TestEventHandlerMiddleware(t *testing.T) { + t.Parallel() + order := []string{} middleware := func(s string) EventHandlerMiddleware { return EventHandlerMiddleware(func(h EventHandler) EventHandler { diff --git a/mocks/mocks_test.go b/mocks/mocks_test.go index b0e9a7df..553a8d37 100644 --- a/mocks/mocks_test.go +++ b/mocks/mocks_test.go @@ -22,6 +22,8 @@ import ( ) func TestMockContext(t *testing.T) { + t.Parallel() + ctx := WithContextOne(context.Background(), "string") if val, ok := ContextOne(ctx); !ok || val != "string" { t.Error("the context value should exist") diff --git a/namespace/context_test.go b/namespace/context_test.go index cd9d0305..6a43c9fb 100644 --- a/namespace/context_test.go +++ b/namespace/context_test.go @@ -23,6 +23,8 @@ import ( ) func TestContext(t *testing.T) { + t.Parallel() + ctx := context.Background() if ns := FromContext(ctx); ns != DefaultNamespace { diff --git a/namespace/eventstore_test.go b/namespace/eventstore_test.go index b732e5e1..84bb2a48 100644 --- a/namespace/eventstore_test.go +++ b/namespace/eventstore_test.go @@ -25,6 +25,8 @@ import ( // NOTE: Not named "Integration" to enable running with the unit tests. func TestEventStore(t *testing.T) { + t.Parallel() + usedNamespaces := map[string]struct{}{} store := NewEventStore(func(ns string) (eh.EventStore, error) { diff --git a/repo/cache/repo_test.go b/repo/cache/repo_test.go index 63746b1b..ccef8eb3 100644 --- a/repo/cache/repo_test.go +++ b/repo/cache/repo_test.go @@ -26,6 +26,8 @@ import ( // NOTE: Not named "Integration" to enable running with the unit tests. func TestReadRepo(t *testing.T) { + t.Parallel() + baseRepo := memory.NewRepo() baseRepo.SetEntityFactory(func() eh.Entity { return &mocks.Model{} @@ -43,6 +45,8 @@ func TestReadRepo(t *testing.T) { } func TestIntoRepo(t *testing.T) { + t.Parallel() + if r := IntoRepo(context.Background(), nil); r != nil { t.Error("the repository should be nil:", r) } diff --git a/repo/memory/repo_test.go b/repo/memory/repo_test.go index 8d9402a5..04ff9351 100644 --- a/repo/memory/repo_test.go +++ b/repo/memory/repo_test.go @@ -25,6 +25,8 @@ import ( // NOTE: Not named "Integration" to enable running with the unit tests. func TestReadRepo(t *testing.T) { + t.Parallel() + r := NewRepo() if r == nil { t.Error("there should be a repository") @@ -41,6 +43,8 @@ func TestReadRepo(t *testing.T) { } func TestIntoRepo(t *testing.T) { + t.Parallel() + if r := IntoRepo(context.Background(), nil); r != nil { t.Error("the repository should be nil:", r) } diff --git a/repo/version/context_test.go b/repo/version/context_test.go index bad1a64e..303cb95f 100644 --- a/repo/version/context_test.go +++ b/repo/version/context_test.go @@ -23,6 +23,8 @@ import ( ) func TestContextMinVersion(t *testing.T) { + t.Parallel() + ctx := context.Background() if v, ok := MinVersionFromContext(ctx); ok { diff --git a/repo/version/repo_test.go b/repo/version/repo_test.go index f6415378..631ce17a 100644 --- a/repo/version/repo_test.go +++ b/repo/version/repo_test.go @@ -30,6 +30,8 @@ import ( // NOTE: Not named "Integration" to enable running with the unit tests. func TestReadRepo(t *testing.T) { + t.Parallel() + baseRepo := memory.NewRepo() baseRepo.SetEntityFactory(func() eh.Entity { return &mocks.Model{} @@ -252,6 +254,8 @@ func extraRepoTests(t *testing.T, r *Repo, baseRepo *memory.Repo) { } func TestIntoRepo(t *testing.T) { + t.Parallel() + if r := IntoRepo(context.Background(), nil); r != nil { t.Error("the repository should be nil:", r) }