@@ -19,6 +19,13 @@ init_per_suite(Config) ->
19
19
end_per_suite (_Config ) ->
20
20
ok = application :stop (katipo ).
21
21
22
+ init_per_group (http , Config ) ->
23
+ application :ensure_all_started (cowboy ),
24
+ Filename = tempfile :name (" katipo_test_" ),
25
+ Dispatch = cowboy_router :compile ([{'_' , [{" /unix" , get_handler , []}]}]),
26
+ {ok , _ } = cowboy :start_clear (unix_socket , [{ip , {local , Filename }},
27
+ {port , 0 }], #{env => #{dispatch => Dispatch }}),
28
+ [{unix_socket_file , Filename } | Config ];
22
29
init_per_group (session , Config ) ->
23
30
application :ensure_all_started (katipo ),
24
31
Config ;
@@ -43,6 +50,10 @@ init_per_group(proxy, Config) ->
43
50
init_per_group (_ , Config ) ->
44
51
Config .
45
52
53
+ end_per_group (http , Config ) ->
54
+ Filename = ? config (unix_socket_file , Config ),
55
+ _ = file :delete (Filename ),
56
+ Config ;
46
57
end_per_group (pool , Config ) ->
47
58
application :stop (meck ),
48
59
Config ;
@@ -425,10 +436,11 @@ interface_unknown(_) ->
425
436
{error , #{code := interface_failed }} =
426
437
katipo :get (? POOL , <<" https://httpbin.org/get" >>, #{interface => <<" cannot_be_an_interface" >>}).
427
438
428
- unix_socket_path (_ ) ->
429
- case katipo :get (? POOL , <<" http://localhost/images/json" >>, #{unix_socket_path => <<" /var/run/docker.sock" >>}) of
439
+ unix_socket_path (Config ) ->
440
+ Filename = list_to_binary (? config (unix_socket_file , Config )),
441
+ case katipo :get (? POOL , <<" http://localhost/unix" >>, #{unix_socket_path => Filename }) of
430
442
{ok , #{status := 200 , headers := Headers }} ->
431
- <<" Docker/ " , _ / binary >> = proplists :get_value (<<" Server " >>, Headers );
443
+ <<" Cowboy " >> = proplists :get_value (<<" server " >>, Headers );
432
444
{error , #{code := bad_opts }} ->
433
445
ct :pal (" unix_socket_path not supported by installed version of curl" ),
434
446
ok
0 commit comments