@@ -21,7 +21,7 @@ import (
21
21
"github.com/quay/clair/v4/notifier"
22
22
)
23
23
24
- func setURI (t * testing.T , cfg * config.STOMP , uri string ) (dial string , opt []func (* stomp.Conn ) error ) {
24
+ func setURI (t * testing.T , cfg config.STOMP , uri string ) (next config. STOMP , dial string , opt []func (* stomp.Conn ) error ) {
25
25
const (
26
26
defaultStompBrokerURI = "localhost:61613"
27
27
)
@@ -30,28 +30,30 @@ func setURI(t *testing.T, cfg *config.STOMP, uri string) (dial string, opt []fun
30
30
case uri == "" :
31
31
t .Logf ("using default broker URI: %q" , defaultStompBrokerURI )
32
32
cfg .URIs = append (cfg .URIs , defaultStompBrokerURI )
33
- return defaultStompBrokerURI , nil
33
+ return cfg , defaultStompBrokerURI , nil
34
34
case strings .Contains (uri , "://" ): // probably a URL
35
35
u , err := url .Parse (uri )
36
36
if err != nil {
37
37
t .Logf ("weird test URI: %q: %v" , uri , err )
38
38
return setURI (t , cfg , "" )
39
39
}
40
- t .Logf ("using broker URI : %q" , u .Host )
40
+ t .Logf ("using broker address : %q" , u .Host )
41
41
cfg .URIs = append (cfg .URIs , u .Host )
42
+ t .Logf ("using broker vhost: %q" , u .Hostname ())
43
+ opt = append (opt , stomp .ConnOpt .Host (u .Hostname ()))
42
44
if u := u .User ; u != nil {
43
45
t .Logf ("using login: %q" , u .String ())
44
46
cfg .Login = & config.Login {
45
47
Login : u .Username (),
46
48
}
47
49
cfg .Login .Passcode , _ = u .Password ()
48
- opt = append (opt , stomp .ConnOpt .Login (u . Username () , cfg .Login .Passcode ))
50
+ opt = append (opt , stomp .ConnOpt .Login (cfg . Login . Login , cfg .Login .Passcode ))
49
51
}
50
- return u .Host , opt
52
+ return cfg , u .Host , opt
51
53
default :
52
54
t .Logf ("using broker URI: %q" , uri )
53
55
cfg .URIs = append (cfg .URIs , uri )
54
- return uri , nil
56
+ return cfg , uri , nil
55
57
}
56
58
}
57
59
@@ -125,7 +127,7 @@ func TestDeliverer(t *testing.T) {
125
127
},
126
128
}
127
129
)
128
- dial , opt := setURI (t , & conf , os .Getenv ("STOMP_CONNECTION_STRING" ))
130
+ conf , dial , opt := setURI (t , conf , os .Getenv ("STOMP_CONNECTION_STRING" ))
129
131
opt = append (opt , stomp .ConnOpt .Logger (logAdapter {t }))
130
132
131
133
// test parallel usage
@@ -205,7 +207,7 @@ func TestDirectDeliverer(t *testing.T) {
205
207
Rollup : tt .rollup ,
206
208
Destination : queue ,
207
209
}
208
- dial , opt := setURI (t , & conf , os .Getenv ("STOMP_CONNECTION_STRING" ))
210
+ conf , dial , opt := setURI (t , conf , os .Getenv ("STOMP_CONNECTION_STRING" ))
209
211
210
212
noteID := uuid .New ()
211
213
notes := make ([]notifier.Notification , 0 , tt .notes )
0 commit comments