@@ -56,7 +56,7 @@ func TestServer(t *testing.T) {
56
56
root , cfg := clitest .New (t ,
57
57
"server" ,
58
58
"--address" , ":0" ,
59
- "--access-url" , "example.com" ,
59
+ "--access-url" , "http:// example.com" ,
60
60
"--postgres-url" , connectionURL ,
61
61
"--cache-dir" , t .TempDir (),
62
62
)
@@ -91,7 +91,7 @@ func TestServer(t *testing.T) {
91
91
root , cfg := clitest .New (t ,
92
92
"server" ,
93
93
"--address" , ":0" ,
94
- "--access-url" , "example.com" ,
94
+ "--access-url" , "http:// example.com" ,
95
95
"--cache-dir" , t .TempDir (),
96
96
)
97
97
pty := ptytest .New (t )
@@ -120,10 +120,9 @@ func TestServer(t *testing.T) {
120
120
pty .ExpectMatch ("psql" )
121
121
})
122
122
123
- // Validate that an http scheme is prepended to a loopback
124
- // access URL and that a warning is printed that it may not be externally
123
+ // Validate that a warning is printed that it may not be externally
125
124
// reachable.
126
- t .Run ("NoSchemeLocalAccessURL " , func (t * testing.T ) {
125
+ t .Run ("LocalAccessURL " , func (t * testing.T ) {
127
126
t .Parallel ()
128
127
ctx , cancelFunc := context .WithCancel (context .Background ())
129
128
defer cancelFunc ()
@@ -132,7 +131,7 @@ func TestServer(t *testing.T) {
132
131
"server" ,
133
132
"--in-memory" ,
134
133
"--address" , ":0" ,
135
- "--access-url" , "localhost:3000/" ,
134
+ "--access-url" , "http:// localhost:3000/" ,
136
135
"--cache-dir" , t .TempDir (),
137
136
)
138
137
pty := ptytest .New (t )
@@ -155,7 +154,7 @@ func TestServer(t *testing.T) {
155
154
156
155
// Validate that an https scheme is prepended to a remote access URL
157
156
// and that a warning is printed for a host that cannot be resolved.
158
- t .Run ("NoSchemeRemoteAccessURL " , func (t * testing.T ) {
157
+ t .Run ("RemoteAccessURL " , func (t * testing.T ) {
159
158
t .Parallel ()
160
159
ctx , cancelFunc := context .WithCancel (context .Background ())
161
160
defer cancelFunc ()
@@ -164,8 +163,7 @@ func TestServer(t *testing.T) {
164
163
"server" ,
165
164
"--in-memory" ,
166
165
"--address" , ":0" ,
167
- "--access-url" , "example.com" ,
168
- "--access-url" , "foobarbaz.mydomain" ,
166
+ "--access-url" , "https://foobarbaz.mydomain" ,
169
167
"--cache-dir" , t .TempDir (),
170
168
)
171
169
pty := ptytest .New (t )
@@ -195,7 +193,6 @@ func TestServer(t *testing.T) {
195
193
"server" ,
196
194
"--in-memory" ,
197
195
"--address" , ":0" ,
198
- "--access-url" , "example.com" ,
199
196
"--access-url" , "https://google.com" ,
200
197
"--cache-dir" , t .TempDir (),
201
198
)
@@ -216,6 +213,22 @@ func TestServer(t *testing.T) {
216
213
require .NoError (t , <- errC )
217
214
})
218
215
216
+ t .Run ("NoSchemeAccessURL" , func (t * testing.T ) {
217
+ t .Parallel ()
218
+ ctx , cancelFunc := context .WithCancel (context .Background ())
219
+ defer cancelFunc ()
220
+
221
+ root , _ := clitest .New (t ,
222
+ "server" ,
223
+ "--in-memory" ,
224
+ "--address" , ":0" ,
225
+ "--access-url" , "google.com" ,
226
+ "--cache-dir" , t .TempDir (),
227
+ )
228
+ err := root .ExecuteContext (ctx )
229
+ require .Error (t , err )
230
+ })
231
+
219
232
t .Run ("TLSBadVersion" , func (t * testing.T ) {
220
233
t .Parallel ()
221
234
ctx , cancelFunc := context .WithCancel (context .Background ())
@@ -225,7 +238,7 @@ func TestServer(t *testing.T) {
225
238
"server" ,
226
239
"--in-memory" ,
227
240
"--address" , ":0" ,
228
- "--access-url" , "example.com" ,
241
+ "--access-url" , "http:// example.com" ,
229
242
"--tls-enable" ,
230
243
"--tls-min-version" , "tls9" ,
231
244
"--cache-dir" , t .TempDir (),
@@ -242,7 +255,7 @@ func TestServer(t *testing.T) {
242
255
"server" ,
243
256
"--in-memory" ,
244
257
"--address" , ":0" ,
245
- "--access-url" , "example.com" ,
258
+ "--access-url" , "http:// example.com" ,
246
259
"--tls-enable" ,
247
260
"--tls-client-auth" , "something" ,
248
261
"--cache-dir" , t .TempDir (),
@@ -299,7 +312,7 @@ func TestServer(t *testing.T) {
299
312
"server" ,
300
313
"--in-memory" ,
301
314
"--address" , ":0" ,
302
- "--access-url" , "example.com" ,
315
+ "--access-url" , "http:// example.com" ,
303
316
"--cache-dir" , t .TempDir (),
304
317
}
305
318
args = append (args , c .args ... )
@@ -320,7 +333,7 @@ func TestServer(t *testing.T) {
320
333
"server" ,
321
334
"--in-memory" ,
322
335
"--address" , ":0" ,
323
- "--access-url" , "example.com" ,
336
+ "--access-url" , "http:// example.com" ,
324
337
"--tls-enable" ,
325
338
"--tls-cert-file" , certPath ,
326
339
"--tls-key-file" , keyPath ,
@@ -360,7 +373,7 @@ func TestServer(t *testing.T) {
360
373
"server" ,
361
374
"--in-memory" ,
362
375
"--address" , ":0" ,
363
- "--access-url" , "example.com" ,
376
+ "--access-url" , "http:// example.com" ,
364
377
"--tls-enable" ,
365
378
"--tls-cert-file" , cert1Path ,
366
379
"--tls-key-file" , key1Path ,
@@ -444,7 +457,7 @@ func TestServer(t *testing.T) {
444
457
"server" ,
445
458
"--in-memory" ,
446
459
"--address" , ":0" ,
447
- "--access-url" , "example.com" ,
460
+ "--access-url" , "http:// example.com" ,
448
461
"--provisioner-daemons" , "1" ,
449
462
"--cache-dir" , t .TempDir (),
450
463
)
@@ -471,7 +484,7 @@ func TestServer(t *testing.T) {
471
484
"server" ,
472
485
"--in-memory" ,
473
486
"--address" , ":0" ,
474
- "--access-url" , "example.com" ,
487
+ "--access-url" , "http:// example.com" ,
475
488
"--trace=true" ,
476
489
"--cache-dir" , t .TempDir (),
477
490
)
@@ -509,7 +522,7 @@ func TestServer(t *testing.T) {
509
522
"server" ,
510
523
"--in-memory" ,
511
524
"--address" , ":0" ,
512
- "--access-url" , "example.com" ,
525
+ "--access-url" , "http:// example.com" ,
513
526
"--telemetry" ,
514
527
"--telemetry-url" , server .URL ,
515
528
"--cache-dir" , t .TempDir (),
@@ -540,7 +553,7 @@ func TestServer(t *testing.T) {
540
553
"server" ,
541
554
"--in-memory" ,
542
555
"--address" , ":0" ,
543
- "--access-url" , "example.com" ,
556
+ "--access-url" , "http:// example.com" ,
544
557
"--provisioner-daemons" , "1" ,
545
558
"--prometheus-enable" ,
546
559
"--prometheus-address" , ":" + strconv .Itoa (randomPort ),
@@ -593,7 +606,7 @@ func TestServer(t *testing.T) {
593
606
"server" ,
594
607
"--in-memory" ,
595
608
"--address" , ":0" ,
596
- "--access-url" , "example.com" ,
609
+ "--access-url" , "http:// example.com" ,
597
610
"--oauth2-github-client-id" , "fake" ,
598
611
"--oauth2-github-client-secret" , "fake" ,
599
612
"--oauth2-github-enterprise-base-url" , fakeRedirect ,
0 commit comments