@@ -12,7 +12,7 @@ import (
12
12
13
13
func TestTopicSubscripiton (t * testing.T ) {
14
14
t .Run ("duplicate metadata" , func (t * testing.T ) {
15
- sub := internal .NewTopicSubscription ("test" , "mytopic" )
15
+ sub := internal .NewTopicSubscription ("test" , "mytopic" , "" )
16
16
require .NoError (t , sub .SetMetadata (map [string ]string {
17
17
"test" : "test" ,
18
18
}))
@@ -22,23 +22,23 @@ func TestTopicSubscripiton(t *testing.T) {
22
22
})
23
23
24
24
t .Run ("duplicate route" , func (t * testing.T ) {
25
- sub := internal .NewTopicSubscription ("test" , "mytopic" )
25
+ sub := internal .NewTopicSubscription ("test" , "mytopic" , "" )
26
26
require .NoError (t , sub .SetDefaultRoute ("/test" ))
27
27
assert .Equal (t , "/test" , sub .Route )
28
28
require .EqualError (t , sub .SetDefaultRoute ("/test" ),
29
29
"subscription for topic mytopic on pubsub test already has route /test" )
30
30
})
31
31
32
32
t .Run ("duplicate route after routing rule" , func (t * testing.T ) {
33
- sub := internal .NewTopicSubscription ("test" , "mytopic" )
33
+ sub := internal .NewTopicSubscription ("test" , "mytopic" , "" )
34
34
require .NoError (t , sub .AddRoutingRule ("/other" , `event.type == "test"` , 0 ))
35
35
require .NoError (t , sub .SetDefaultRoute ("/test" ))
36
36
require .EqualError (t , sub .SetDefaultRoute ("/test" ),
37
37
"subscription for topic mytopic on pubsub test already has route /test" )
38
38
})
39
39
40
40
t .Run ("default route after routing rule" , func (t * testing.T ) {
41
- sub := internal .NewTopicSubscription ("test" , "mytopic" )
41
+ sub := internal .NewTopicSubscription ("test" , "mytopic" , "" )
42
42
require .NoError (t , sub .SetDefaultRoute ("/test" ))
43
43
assert .Equal (t , "/test" , sub .Route )
44
44
require .NoError (t , sub .AddRoutingRule ("/other" , `event.type == "test"` , 0 ))
@@ -49,14 +49,14 @@ func TestTopicSubscripiton(t *testing.T) {
49
49
})
50
50
51
51
t .Run ("duplicate routing rule priority" , func (t * testing.T ) {
52
- sub := internal .NewTopicSubscription ("test" , "mytopic" )
52
+ sub := internal .NewTopicSubscription ("test" , "mytopic" , "" )
53
53
require .NoError (t , sub .AddRoutingRule ("/other" , `event.type == "other"` , 1 ))
54
54
require .EqualError (t , sub .AddRoutingRule ("/test" , `event.type == "test"` , 1 ),
55
55
"subscription for topic mytopic on pubsub test already has a routing rule with priority 1" )
56
56
})
57
57
58
58
t .Run ("priority ordering" , func (t * testing.T ) {
59
- sub := internal .NewTopicSubscription ("test" , "mytopic" )
59
+ sub := internal .NewTopicSubscription ("test" , "mytopic" , "" )
60
60
require .NoError (t , sub .AddRoutingRule ("/100" , `event.type == "100"` , 100 ))
61
61
require .NoError (t , sub .AddRoutingRule ("/1" , `event.type == "1"` , 1 ))
62
62
require .NoError (t , sub .AddRoutingRule ("/50" , `event.type == "50"` , 50 ))
0 commit comments