File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
x-pack/spec/config_management Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 170170 expect { described_class . new ( system_settings ) } . to_not raise_error
171171 end
172172 end
173+
174+ context "when api_key is set (encoded or not)" do
175+ [
176+ { desc : "non-encoded" , value : "foo:bar" } ,
177+ { desc : "encoded" , value : Base64 . strict_encode64 ( "foo:bar" ) }
178+ ] . each do |api_key_case |
179+ context "with #{ api_key_case [ :desc ] } api_key" do
180+ let ( :settings ) do
181+ {
182+ "xpack.management.enabled" => true ,
183+ "xpack.management.pipeline.id" => "main" ,
184+ "xpack.management.elasticsearch.api_key" => api_key_case [ :value ] ,
185+ }
186+ end
187+
188+ it "will rely on #{ api_key_case [ :desc ] } api_key for authentication" do
189+ # the http client used by xpack module is the same as the one used by the ES output plugin
190+ # and the HttpClientBuilder.setup_api_key method will handle both encoded and non-encoded api_key values.
191+ # These tests prevent future regressions if the plugin client is changed.
192+ expect { described_class . new ( system_settings ) } . to_not raise_error
193+ end
194+ end
195+ end
196+ end
173197 end
174198
175199 context "valid settings" do
You can’t perform that action at this time.
0 commit comments