Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions x-pack/spec/config_management/elasticsearch_source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,30 @@
expect { described_class.new(system_settings) }.to_not raise_error
end
end

context "when api_key is set (encoded or not)" do
[
{ desc: "non-encoded", value: "foo:bar" },
{ desc: "encoded", value: Base64.strict_encode64("foo:bar") }
].each do |api_key_case|
context "with #{api_key_case[:desc]} api_key" do
let(:settings) do
{
"xpack.management.enabled" => true,
"xpack.management.pipeline.id" => "main",
"xpack.management.elasticsearch.api_key" => api_key_case[:value],
}
end

it "will rely on #{api_key_case[:desc]} api_key for authentication" do
# the http client used by xpack module is the same as the one used by the ES output plugin
# and the HttpClientBuilder.setup_api_key method will handle both encoded and non-encoded api_key values.
# These tests prevent future regressions if the plugin client is changed.
expect { described_class.new(system_settings) }.to_not raise_error
end
end
end
end
end

context "valid settings" do
Expand Down