-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnection_test.go
56 lines (49 loc) · 1.47 KB
/
connection_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package vnats
import (
"testing"
)
func TestConnection_NewPublisher(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
conn := makeIntegrationTestConn(t)
_, err := conn.NewPublisher(PublisherArgs{
StreamName: integrationTestStreamName,
})
if err != nil {
t.Errorf("Publisher could not be created: %v", err)
}
}
type newSubscriberConfig struct {
consumerName string
subject string
mode SubscriptionMode
}
var newSubscriberTestCases = []newSubscriberConfig{
{"IntegrationTestConsumer", integrationTestStreamName + ".*", MultipleSubscribersAllowed},
{"IntegrationTestConsumer", integrationTestStreamName + ".*", SingleSubscriberStrictMessageOrder},
{"IntegrationTestConsumer", integrationTestStreamName + ".tests.*", MultipleSubscribersAllowed},
{"IntegrationTestConsumer", integrationTestStreamName + ".tests.*", SingleSubscriberStrictMessageOrder},
}
func TestConnection_NewSubscriber(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
for _, test := range newSubscriberTestCases {
conn := makeIntegrationTestConn(t)
_, err := conn.NewPublisher(PublisherArgs{
StreamName: integrationTestStreamName,
})
if err != nil {
t.Errorf("Publisher could not be created: %v", err)
}
_, err = conn.NewSubscriber(SubscriberArgs{
ConsumerName: test.consumerName,
Subject: test.subject,
Mode: test.mode,
})
if err != nil {
t.Errorf("Subscriber could not be created: %v", err)
}
}
}