mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Synthetics] preserve id field on monitor attributes (#142478)
* synthetics - preserve id field on monitor attributes * adjust tests * [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix' * adjust jest tests * adjust tests * adjust types * adjust tests * adjust types * update tests * [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix' Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
87fa95d49e
commit
61342b3073
20 changed files with 61 additions and 7 deletions
|
@ -47,6 +47,9 @@ export const DEFAULT_COMMON_FIELDS: CommonFields = {
|
|||
[ConfigKey.NAMESPACE]: DEFAULT_NAMESPACE_STRING,
|
||||
[ConfigKey.MONITOR_SOURCE_TYPE]: SourceType.UI,
|
||||
[ConfigKey.JOURNEY_ID]: '',
|
||||
|
||||
// Deprecated, slated to be removed in a future version
|
||||
[ConfigKey.ID]: '',
|
||||
};
|
||||
|
||||
export const DEFAULT_BROWSER_ADVANCED_FIELDS: BrowserAdvancedFields = {
|
||||
|
@ -88,15 +91,17 @@ export const DEFAULT_BROWSER_SIMPLE_FIELDS: BrowserSimpleFields = {
|
|||
[ConfigKey.SOURCE_ZIP_FOLDER]: '',
|
||||
[ConfigKey.SOURCE_ZIP_PROXY_URL]: '',
|
||||
[ConfigKey.TEXT_ASSERTION]: '',
|
||||
[ConfigKey.URLS]: '',
|
||||
[ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.MULTISTEP,
|
||||
[ConfigKey.TIMEOUT]: null,
|
||||
|
||||
// Deprecated, slated to be removed in a future version
|
||||
[ConfigKey.ZIP_URL_TLS_CERTIFICATE_AUTHORITIES]: undefined,
|
||||
[ConfigKey.ZIP_URL_TLS_CERTIFICATE]: undefined,
|
||||
[ConfigKey.ZIP_URL_TLS_KEY]: undefined,
|
||||
[ConfigKey.ZIP_URL_TLS_KEY_PASSPHRASE]: undefined,
|
||||
[ConfigKey.ZIP_URL_TLS_VERIFICATION_MODE]: undefined,
|
||||
[ConfigKey.ZIP_URL_TLS_VERSION]: undefined,
|
||||
[ConfigKey.URLS]: '',
|
||||
[ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.MULTISTEP,
|
||||
[ConfigKey.TIMEOUT]: null,
|
||||
};
|
||||
|
||||
export const DEFAULT_HTTP_SIMPLE_FIELDS: HTTPSimpleFields = {
|
||||
|
@ -143,6 +148,7 @@ export const DEFAULT_TCP_SIMPLE_FIELDS: TCPSimpleFields = {
|
|||
is_tls_enabled: false,
|
||||
},
|
||||
[ConfigKey.HOSTS]: '',
|
||||
[ConfigKey.URLS]: '',
|
||||
[ConfigKey.MONITOR_TYPE]: DataStream.TCP,
|
||||
[ConfigKey.FORM_MONITOR_TYPE]: FormMonitorType.TCP,
|
||||
[ConfigKey.PORT]: null,
|
||||
|
|
|
@ -77,6 +77,9 @@ export enum ConfigKey {
|
|||
ZIP_URL_TLS_KEY_PASSPHRASE = 'source.zip_url.ssl.key_passphrase',
|
||||
ZIP_URL_TLS_VERIFICATION_MODE = 'source.zip_url.ssl.verification_mode',
|
||||
ZIP_URL_TLS_VERSION = 'source.zip_url.ssl.supported_protocols',
|
||||
|
||||
// deprecated, slated to be removed in a future version
|
||||
ID = 'id',
|
||||
}
|
||||
|
||||
export const secretKeys = [
|
||||
|
|
|
@ -32,6 +32,9 @@ export const commonFormatters: CommonFormatMap = {
|
|||
[ConfigKey.PROJECT_ID]: null,
|
||||
[ConfigKey.CUSTOM_HEARTBEAT_ID]: null,
|
||||
[ConfigKey.ORIGINAL_SPACE]: null,
|
||||
|
||||
// Deprecated, slated to be removed in a later release
|
||||
[ConfigKey.ID]: null,
|
||||
};
|
||||
|
||||
export const arrayToJsonFormatter = (value: string[] = []) =>
|
||||
|
|
|
@ -20,6 +20,7 @@ export const tcpFormatters: TCPFormatMap = {
|
|||
[ConfigKey.RESPONSE_RECEIVE_CHECK]: null,
|
||||
[ConfigKey.REQUEST_SEND_CHECK]: null,
|
||||
[ConfigKey.PORT]: null,
|
||||
[ConfigKey.URLS]: null,
|
||||
...tlsFormatters,
|
||||
...commonFormatters,
|
||||
};
|
||||
|
|
|
@ -86,6 +86,7 @@ export const CommonFieldsCodec = t.intersection([
|
|||
[ConfigKey.PROJECT_ID]: t.string,
|
||||
[ConfigKey.ORIGINAL_SPACE]: t.string,
|
||||
[ConfigKey.CUSTOM_HEARTBEAT_ID]: t.string,
|
||||
[ConfigKey.ID]: t.string,
|
||||
}),
|
||||
]);
|
||||
|
||||
|
@ -98,6 +99,9 @@ export const TCPSimpleFieldsCodec = t.intersection([
|
|||
[ConfigKey.HOSTS]: t.string,
|
||||
[ConfigKey.PORT]: t.union([t.number, t.null]),
|
||||
}),
|
||||
t.partial({
|
||||
[ConfigKey.URLS]: t.string,
|
||||
}),
|
||||
CommonFieldsCodec,
|
||||
]);
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ describe('format', () => {
|
|||
urls: 'sample url',
|
||||
'url.port': null,
|
||||
username: '',
|
||||
id: '',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -284,6 +285,7 @@ describe('format', () => {
|
|||
type: 'browser',
|
||||
'url.port': null,
|
||||
urls: '',
|
||||
id: '',
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -350,6 +352,7 @@ describe('format', () => {
|
|||
urls: 'sample url',
|
||||
'url.port': null,
|
||||
username: '',
|
||||
id: '',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -96,4 +96,7 @@ export const commonNormalizers: CommonNormalizerMap = {
|
|||
[ConfigKey.PROJECT_ID]: getCommonNormalizer(ConfigKey.PROJECT_ID),
|
||||
[ConfigKey.CUSTOM_HEARTBEAT_ID]: getCommonNormalizer(ConfigKey.CUSTOM_HEARTBEAT_ID),
|
||||
[ConfigKey.ORIGINAL_SPACE]: getCommonNormalizer(ConfigKey.ORIGINAL_SPACE),
|
||||
|
||||
// Deprecated, slated to be removed in a future release
|
||||
[ConfigKey.ID]: getCommonNormalizer(ConfigKey.ID),
|
||||
};
|
||||
|
|
|
@ -38,6 +38,7 @@ export const tcpNormalizers: TCPNormalizerMap = {
|
|||
[ConfigKey.PROXY_USE_LOCAL_RESOLVER]: getTCPNormalizer(ConfigKey.PROXY_USE_LOCAL_RESOLVER),
|
||||
[ConfigKey.RESPONSE_RECEIVE_CHECK]: getTCPNormalizer(ConfigKey.RESPONSE_RECEIVE_CHECK),
|
||||
[ConfigKey.REQUEST_SEND_CHECK]: getTCPNormalizer(ConfigKey.REQUEST_SEND_CHECK),
|
||||
[ConfigKey.URLS]: getTCPNormalizer(ConfigKey.URLS),
|
||||
...tlsNormalizers,
|
||||
...commonNormalizers,
|
||||
};
|
||||
|
|
|
@ -34,6 +34,9 @@ export const commonFormatters: CommonFormatMap = {
|
|||
[ConfigKey.PROJECT_ID]: null,
|
||||
[ConfigKey.CUSTOM_HEARTBEAT_ID]: null,
|
||||
[ConfigKey.ORIGINAL_SPACE]: null,
|
||||
|
||||
// Deprecated, slated to be removed in a later releae
|
||||
[ConfigKey.ID]: null,
|
||||
};
|
||||
|
||||
export const arrayFormatter = (value: string[] = []) => (value.length ? value : null);
|
||||
|
|
|
@ -19,6 +19,7 @@ export const tcpFormatters: TCPFormatMap = {
|
|||
[ConfigKey.PROXY_USE_LOCAL_RESOLVER]: null,
|
||||
[ConfigKey.RESPONSE_RECEIVE_CHECK]: null,
|
||||
[ConfigKey.REQUEST_SEND_CHECK]: null,
|
||||
[ConfigKey.URLS]: null,
|
||||
...tlsFormatters,
|
||||
...commonFormatters,
|
||||
};
|
||||
|
|
|
@ -157,6 +157,7 @@ describe('browser normalizers', () => {
|
|||
original_space: 'test-space',
|
||||
custom_heartbeat_id: 'test-id-1-test-project-id-test-space',
|
||||
timeout: null,
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
errors: [],
|
||||
|
@ -213,6 +214,7 @@ describe('browser normalizers', () => {
|
|||
original_space: 'test-space',
|
||||
custom_heartbeat_id: 'test-id-2-test-project-id-test-space',
|
||||
timeout: null,
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
errors: [],
|
||||
|
@ -276,6 +278,7 @@ describe('browser normalizers', () => {
|
|||
original_space: 'test-space',
|
||||
custom_heartbeat_id: 'test-id-3-test-project-id-test-space',
|
||||
timeout: null,
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
errors: [],
|
||||
|
|
|
@ -181,6 +181,7 @@ describe('http normalizers', () => {
|
|||
urls: 'http://localhost:9200',
|
||||
'url.port': null,
|
||||
username: '',
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: ['check.response.body', 'unsupportedKey.nestedUnsupportedKey'],
|
||||
},
|
||||
|
@ -235,6 +236,7 @@ describe('http normalizers', () => {
|
|||
urls: 'http://localhost:9200',
|
||||
'url.port': null,
|
||||
username: '',
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
},
|
||||
|
|
|
@ -127,6 +127,7 @@ describe('icmp normalizers', () => {
|
|||
timeout: '60',
|
||||
type: 'icmp',
|
||||
wait: '30',
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
},
|
||||
|
@ -166,6 +167,7 @@ describe('icmp normalizers', () => {
|
|||
timeout: '16',
|
||||
type: 'icmp',
|
||||
wait: '60',
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
},
|
||||
|
@ -218,6 +220,7 @@ describe('icmp normalizers', () => {
|
|||
timeout: '16',
|
||||
type: 'icmp',
|
||||
wait: '1',
|
||||
id: '',
|
||||
},
|
||||
unsupportedKeys: ['unsupportedKey.nestedUnsupportedKey'],
|
||||
},
|
||||
|
|
|
@ -142,6 +142,8 @@ describe('tcp normalizers', () => {
|
|||
tags: ['service:smtp', 'org:google'],
|
||||
timeout: '16',
|
||||
type: 'tcp',
|
||||
id: '',
|
||||
urls: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
},
|
||||
|
@ -194,6 +196,8 @@ describe('tcp normalizers', () => {
|
|||
tags: ['tag1', 'tag2'],
|
||||
timeout: '16',
|
||||
type: 'tcp',
|
||||
id: '',
|
||||
urls: '',
|
||||
},
|
||||
unsupportedKeys: [],
|
||||
},
|
||||
|
@ -259,6 +263,8 @@ describe('tcp normalizers', () => {
|
|||
tags: ['tag1', 'tag2'],
|
||||
timeout: '16',
|
||||
type: 'tcp',
|
||||
id: '',
|
||||
urls: '',
|
||||
},
|
||||
unsupportedKeys: ['ports', 'unsupportedKey.nestedUnsupportedKey'],
|
||||
},
|
||||
|
|
|
@ -549,6 +549,7 @@ const payloadData = [
|
|||
type: 'browser',
|
||||
'url.port': null,
|
||||
urls: '',
|
||||
id: '',
|
||||
},
|
||||
{
|
||||
__ui: {
|
||||
|
@ -607,6 +608,7 @@ const payloadData = [
|
|||
type: 'browser',
|
||||
'url.port': null,
|
||||
urls: '',
|
||||
id: '',
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -194,6 +194,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
type: 'browser',
|
||||
'url.port': null,
|
||||
urls: '',
|
||||
id: '',
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
|
@ -307,6 +308,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
type: 'http',
|
||||
urls: Array.isArray(monitor.urls) ? monitor.urls?.[0] : monitor.urls,
|
||||
'url.port': null,
|
||||
id: '',
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
|
@ -406,6 +408,8 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
type: 'tcp',
|
||||
hosts: Array.isArray(monitor.hosts) ? monitor.hosts?.[0] : monitor.hosts,
|
||||
'url.port': null,
|
||||
urls: '',
|
||||
id: '',
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
|
@ -507,6 +511,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
monitor.wait?.slice(-1) === 's'
|
||||
? monitor.wait?.slice(0, -1)
|
||||
: `${parseInt(monitor.wait?.slice(0, -1) || '1', 10) * 60}`,
|
||||
id: '',
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -47,5 +47,6 @@
|
|||
"origin": "ui",
|
||||
"form_monitor_type": "multistep",
|
||||
"urls": "",
|
||||
"url.port": null
|
||||
"url.port": null,
|
||||
"id": ""
|
||||
}
|
||||
|
|
|
@ -79,5 +79,6 @@
|
|||
"revision": 1,
|
||||
"origin": "ui",
|
||||
"form_monitor_type": "http",
|
||||
"journey_id": ""
|
||||
"journey_id": "",
|
||||
"id": ""
|
||||
}
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
"name": "Test HTTP Monitor 04",
|
||||
"namespace": "testnamespace",
|
||||
"origin": "ui",
|
||||
"form_monitor_type": "icmp"
|
||||
"form_monitor_type": "icmp",
|
||||
"id": ""
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"is_zip_url_tls_enabled": false
|
||||
},
|
||||
"hosts": "example-host:40",
|
||||
"urls": "example-host:40",
|
||||
"url.port": null,
|
||||
"proxy_url": "",
|
||||
"proxy_use_local_resolver": false,
|
||||
|
@ -32,5 +33,6 @@
|
|||
"name": "Test HTTP Monitor 04",
|
||||
"namespace": "testnamespace",
|
||||
"origin": "ui",
|
||||
"form_monitor_type": "tcp"
|
||||
"form_monitor_type": "tcp",
|
||||
"id": ""
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue