2020 check_secure_default_shotgun_stream_endpoint /1 ,
2121 check_secure_default_httpc_poll_endpoint /1 ,
2222 check_secure_default_httpc_events_endpoint /1 ,
23- check_secure_default_shotgun_invalid /1
23+ check_secure_default_shotgun_invalid /1 ,
24+ check_secure_default_shotgun_stream_endpoint_federal /1 ,
25+ check_secure_default_httpc_poll_endpoint_federal /1 ,
26+ check_secure_default_httpc_events_endpoint_federal /1
2427]).
2528
2629% %====================================================================
@@ -38,7 +41,10 @@ all() ->
3841 check_secure_default_shotgun_stream_endpoint ,
3942 check_secure_default_httpc_poll_endpoint ,
4043 check_secure_default_httpc_events_endpoint ,
41- check_secure_default_shotgun_invalid
44+ check_secure_default_shotgun_invalid ,
45+ check_secure_default_shotgun_stream_endpoint_federal ,
46+ check_secure_default_httpc_poll_endpoint_federal ,
47+ check_secure_default_httpc_events_endpoint_federal
4248 ].
4349
4450init_per_suite (Config ) ->
@@ -58,7 +64,7 @@ end_per_testcase(_, _Config) ->
5864% % Helpers
5965% %====================================================================
6066
61- open_stream (Uri , HttpOptions ) ->
67+ open_stream (Uri , HttpOptions , SdkKeyEnv ) ->
6268 GunOpts = ldclient_http_options :gun_parse_http_options (HttpOptions ),
6369 Opts = #{gun_opts => GunOpts },
6470 {ok , {Scheme , Host , Port , Path , Query }} = ldclient_http :uri_parse (Uri ),
@@ -84,7 +90,7 @@ open_stream(Uri, HttpOptions) ->
8490 end ,
8591 Options = #{async => true , async_mode => sse , handle_event => F },
8692 Headers = #{
87- " authorization" => os :getenv (" LD_SDK_KEY " ),
93+ " authorization" => os :getenv (SdkKeyEnv ),
8894 <<" user-agent" >> => ldclient_config :get_user_agent ()
8995 },
9096 case shotgun :get (Pid , Path ++ Query , Headers , Options ) of
@@ -105,7 +111,14 @@ check_secure_default_shotgun_stream_endpoint(_) ->
105111 tls_options => ldclient_config :tls_basic_options (),
106112 connect_timeout => undefined ,
107113 custom_headers => undefined
108- }).
114+ }, " LD_SDK_KEY" ).
115+
116+ check_secure_default_shotgun_stream_endpoint_federal (_ ) ->
117+ {ok , _ } = open_stream (" https://stream.launchdarkly.us/all" , #{
118+ tls_options => ldclient_config :tls_basic_options (),
119+ connect_timeout => undefined ,
120+ custom_headers => undefined
121+ }, " LD_FED_SDK_KEY" ).
109122
110123check_secure_default_httpc_poll_endpoint (_ ) ->
111124 Options = [{ssl , ldclient_config :tls_basic_options ()}],
@@ -114,6 +127,13 @@ check_secure_default_httpc_poll_endpoint(_) ->
114127 {" User-Agent" , ldclient_config :get_user_agent ()}
115128 ]}, Options , []).
116129
130+ check_secure_default_httpc_poll_endpoint_federal (_ ) ->
131+ Options = [{ssl , ldclient_config :tls_basic_options ()}],
132+ {ok , _ } = httpc :request (get , {" https://sdk.launchdarkly.us/sdk/latest-all" , [
133+ {" Authorization" , os :getenv (" LD_FED_SDK_KEY" )},
134+ {" User-Agent" , ldclient_config :get_user_agent ()}
135+ ]}, Options , []).
136+
117137check_secure_default_httpc_events_endpoint (_ ) ->
118138 Options = [{ssl , ldclient_config :tls_basic_options ()}],
119139 {ok , _ } = httpc :request (post , {" https://events.launchdarkly.com/bulk" , [
@@ -124,6 +144,16 @@ check_secure_default_httpc_events_endpoint(_) ->
124144 <<" [{\" endDate\" :1634839284004,\" features\" :{\" test-boolean-flag\" :{\" counters\" :[{\" count\" :1,\" unknown\" :false,\" value\" :true,\" variation\" :0,\" version\" :1}],\" default\" :\" default-value\" }},\" kind\" :\" summary\" ,\" startDate\" :1634839284004},{\" creationDate\" :1634839284004,\" kind\" :\" index\" ,\" user\" :{\" firstName\" :\" Tester\" ,\" key\" :\" 12345-track\" ,\" lastName\" :\" Testerson\" ,\" privateAttrs\" :[]}}]" >>
125145 }, Options , []).
126146
147+ check_secure_default_httpc_events_endpoint_federal (_ ) ->
148+ Options = [{ssl , ldclient_config :tls_basic_options ()}],
149+ {ok , _ } = httpc :request (post , {" https://events.launchdarkly.us/bulk" , [
150+ {" Authorization" , os :getenv (" LD_FED_SDK_KEY" )},
151+ {" X-LaunchDarkly-Event-Schema" , ldclient_config :get_event_schema ()},
152+ {" User-Agent" , ldclient_config :get_user_agent ()}],
153+ " application/json" ,
154+ <<" [{\" endDate\" :1634839284004,\" features\" :{\" test-boolean-flag\" :{\" counters\" :[{\" count\" :1,\" unknown\" :false,\" value\" :true,\" variation\" :0,\" version\" :1}],\" default\" :\" default-value\" }},\" kind\" :\" summary\" ,\" startDate\" :1634839284004},{\" creationDate\" :1634839284004,\" kind\" :\" index\" ,\" user\" :{\" firstName\" :\" Tester\" ,\" key\" :\" 12345-track\" ,\" lastName\" :\" Testerson\" ,\" privateAttrs\" :[]}}]" >>
155+ }, Options , []).
156+
127157check_secure_default_httpc_valid (_ ) ->
128158 Options = [{ssl , ldclient_config :tls_basic_options ()}],
129159 {ok , _ } = httpc :request (get , {" https://tls-v1-2.badssl.com:1012/" , []}, Options , []),
@@ -175,4 +205,4 @@ check_secure_default_shotgun_invalid(_) ->
175205 tls_options => ldclient_config :tls_basic_options (),
176206 connect_timeout => undefined ,
177207 custom_headers => undefined
178- }).
208+ }, " LD_SDK_KEY " ).
0 commit comments