mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
synthetics - fall back to checking verification mode to determine if tls is enabled (#117181) (#118943)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Dominique Clarke <doclarke71@gmail.com>
This commit is contained in:
parent
309df6c3df
commit
7b9e727cdc
2 changed files with 42 additions and 12 deletions
|
@ -573,16 +573,43 @@ describe('<SyntheticsPolicyEditExtension />', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('shows tls fields when metadata.is_tls_enabled is true', async () => {
|
||||
const { getByLabelText } = render(<WrappedComponent />);
|
||||
const verificationMode = getByLabelText('Verification mode') as HTMLInputElement;
|
||||
const enableTLSConfig = getByLabelText('Enable TLS configuration') as HTMLInputElement;
|
||||
expect(enableTLSConfig.getAttribute('aria-checked')).toEqual('true');
|
||||
expect(verificationMode).toBeInTheDocument();
|
||||
expect(verificationMode.value).toEqual(
|
||||
`${defaultHTTPConfig[ConfigKeys.TLS_VERIFICATION_MODE]}`
|
||||
);
|
||||
});
|
||||
it.each([[true], [false]])(
|
||||
'shows tls fields when metadata.is_tls_enabled is or verification mode is truthy true',
|
||||
async (isTLSEnabledInUIMetadataKey) => {
|
||||
const currentPolicy = {
|
||||
...defaultCurrentPolicy,
|
||||
inputs: [
|
||||
{
|
||||
...defaultNewPolicy.inputs[0],
|
||||
enabled: true,
|
||||
streams: [
|
||||
{
|
||||
...defaultNewPolicy.inputs[0].streams[0],
|
||||
vars: {
|
||||
...defaultNewPolicy.inputs[0].streams[0].vars,
|
||||
__ui: {
|
||||
type: 'yaml',
|
||||
value: JSON.stringify({
|
||||
is_tls_enabled: isTLSEnabledInUIMetadataKey,
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const { getByLabelText } = render(<WrappedComponent policy={currentPolicy} />);
|
||||
const verificationMode = getByLabelText('Verification mode') as HTMLInputElement;
|
||||
const enableTLSConfig = getByLabelText('Enable TLS configuration') as HTMLInputElement;
|
||||
expect(enableTLSConfig.getAttribute('aria-checked')).toEqual('true');
|
||||
expect(verificationMode).toBeInTheDocument();
|
||||
expect(verificationMode.value).toEqual(
|
||||
`${defaultHTTPConfig[ConfigKeys.TLS_VERIFICATION_MODE]}`
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it('handles browser validation', async () => {
|
||||
const currentPolicy = {
|
||||
|
@ -1128,6 +1155,7 @@ describe('<SyntheticsPolicyEditExtension />', () => {
|
|||
expect(getByText(text)).toBeInTheDocument();
|
||||
}
|
||||
);
|
||||
|
||||
it('hides tls fields when metadata.is_tls_enabled is false', async () => {
|
||||
const { getByLabelText, queryByLabelText } = render(
|
||||
<WrappedComponent
|
||||
|
|
|
@ -71,9 +71,11 @@ export const SyntheticsPolicyEditExtensionWrapper = memo<PackagePolicyEditExtens
|
|||
};
|
||||
|
||||
enableTLS =
|
||||
formattedDefaultConfigForMonitorType[ConfigKeys.METADATA].is_tls_enabled || false;
|
||||
formattedDefaultConfigForMonitorType[ConfigKeys.METADATA].is_tls_enabled ||
|
||||
Boolean(vars?.[ConfigKeys.TLS_VERIFICATION_MODE]?.value);
|
||||
enableZipUrlTLS =
|
||||
formattedDefaultConfigForMonitorType[ConfigKeys.METADATA].is_zip_url_tls_enabled || false;
|
||||
formattedDefaultConfigForMonitorType[ConfigKeys.METADATA].is_zip_url_tls_enabled ||
|
||||
Boolean(vars?.[ConfigKeys.ZIP_URL_TLS_VERIFICATION_MODE]?.value);
|
||||
|
||||
const formattedDefaultConfig: Partial<PolicyConfig> = {
|
||||
[type]: formattedDefaultConfigForMonitorType,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue