Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,44 @@ ssl.test: 123
`);
});

it('should not override advanced yaml ssl fields for elasticsearch output type', () => {
const policyOutput = transformOutputToFullPolicyOutput(
{
id: 'id123',
hosts: ['http://host.fr'],
is_default: false,
is_default_monitoring: false,
name: 'test output',
type: 'elasticsearch',
config_yaml:
'ssl:\n verification_mode: "none"\n certificate_authorities: ["/tmp/ssl/ca.crt"] ',
ssl: {
certificate: '',
certificate_authorities: [],
},
},
undefined,
false
);

expect(policyOutput).toMatchInlineSnapshot(`
Object {
"hosts": Array [
"http://host.fr",
],
"preset": "balanced",
"ssl": Object {
"certificate": "",
"certificate_authorities": Array [
"/tmp/ssl/ca.crt",
],
"verification_mode": "none",
},
"type": "elasticsearch",
}
`);
});

it('should work with kafka output', () => {
const policyOutput = transformOutputToFullPolicyOutput({
id: 'id123',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@ export function transformOutputToFullPolicyOutput(
};
if (ssl) {
newOutput.ssl = {
...newOutput.ssl,
...ssl,
...ssl, // ssl coming from preconfig
...newOutput.ssl, // ssl coming from config_yaml
};
}

Expand Down
Loading