Skip to content

Commit 67d9632

Browse files
committed
expose stubs for testing
1 parent 73c61b1 commit 67d9632

16 files changed

+21
-19
lines changed

aws/sqs_publisher_scheduler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"time"
1111

1212
"github.com/hmoragrega/pubsub"
13-
"github.com/hmoragrega/pubsub/internal/stubs"
1413
"github.com/hmoragrega/pubsub/marshaller"
14+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
1515
)
1616

1717
const maxDelay = 15 * time.Minute

aws/subscriber_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ import (
2323
"github.com/aws/aws-sdk-go-v2/service/sqs"
2424
"github.com/aws/aws-sdk-go-v2/service/sqs/types"
2525
"github.com/aws/smithy-go/logging"
26+
2627
"github.com/hmoragrega/pubsub"
27-
"github.com/hmoragrega/pubsub/internal/stubs"
2828
"github.com/hmoragrega/pubsub/marshaller"
29+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
2930
)
3031

3132
var (

letterbox/letterbox_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"time"
99

1010
"github.com/hmoragrega/pubsub"
11-
"github.com/hmoragrega/pubsub/internal/channels"
1211
"github.com/hmoragrega/pubsub/marshaller"
12+
"github.com/hmoragrega/pubsub/pubsubtest/channels"
1313
)
1414

1515
type sumRequest struct {

marshaller/marshaller_byte_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"testing"
88

99
"github.com/hmoragrega/pubsub"
10-
"github.com/hmoragrega/pubsub/internal/stubs"
10+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
1111
)
1212

1313
func TestByteMarshaller_Marshal(t *testing.T) {

marshaller/marshaller_json_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
"github.com/hmoragrega/pubsub"
9-
"github.com/hmoragrega/pubsub/internal/stubs"
9+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
1010
)
1111

1212
type testJSONStruct struct {

marshaller/unmarshaller_chain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
"github.com/hmoragrega/pubsub"
9-
"github.com/hmoragrega/pubsub/internal/stubs"
9+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
1010
)
1111

1212
func TestChainUnmarshaller_Success(t *testing.T) {

marshaller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
"github.com/hmoragrega/pubsub"
8-
"github.com/hmoragrega/pubsub/internal/stubs"
8+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
99
)
1010

1111
func TestNoOpUnmarshaller(t *testing.T) {

message_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"testing"
77

88
"github.com/hmoragrega/pubsub"
9-
"github.com/hmoragrega/pubsub/internal/stubs"
9+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
1010
)
1111

1212
func TestMessage_Ack(t *testing.T) {

publisher_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"testing"
88

99
"github.com/hmoragrega/pubsub"
10-
"github.com/hmoragrega/pubsub/internal/stubs"
1110
"github.com/hmoragrega/pubsub/marshaller"
11+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
1212
)
1313

1414
func TestPublisher_PublishMarshallFailure(t *testing.T) {

internal/channels/publisher.go renamed to pubsubtest/channels/publisher.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"sync"
66

77
"github.com/hmoragrega/pubsub"
8-
"github.com/hmoragrega/pubsub/internal/stubs"
8+
"github.com/hmoragrega/pubsub/pubsubtest/stubs"
99
)
1010

1111
const queueBuffer = 100
@@ -21,24 +21,25 @@ func (p *Publisher) Publish(ctx context.Context, topic string, envelopes ...*pub
2121

2222
for _, s := range p.subscribers[topic] {
2323
for _, envelope := range envelopes {
24+
e := envelope
2425
rm := stubs.NewNoOpReceivedMessage()
2526
rm.IDFunc = func() string {
26-
return envelope.ID
27+
return e.ID
2728
}
2829
rm.NameFunc = func() string {
29-
return envelope.Name
30+
return e.Name
3031
}
3132
rm.KeyFunc = func() string {
32-
return envelope.Key
33+
return e.Key
3334
}
3435
rm.BodyFunc = func() []byte {
35-
return envelope.Body
36+
return e.Body
3637
}
3738
rm.VersionFunc = func() string {
38-
return envelope.Version
39+
return e.Version
3940
}
4041
rm.AttributesFunc = func() pubsub.Attributes {
41-
return envelope.Attributes
42+
return e.Attributes
4243
}
4344
select {
4445
case <-ctx.Done():

0 commit comments

Comments
 (0)