synthetics - adjust enabled key for browser monitors (#135017)

This commit is contained in:
Dominique Clarke 2022-06-23 13:47:22 -04:00 committed by GitHub
parent c6768782f3
commit 5989f1df49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 1 deletions

View file

@ -101,7 +101,7 @@ export const normalizeProjectMonitor = ({
[ConfigKey.ORIGINAL_SPACE]: namespace || defaultFields[ConfigKey.ORIGINAL_SPACE],
[ConfigKey.CUSTOM_HEARTBEAT_ID]: `${monitor.id}-${projectId}-${namespace}`,
[ConfigKey.TIMEOUT]: null,
[ConfigKey.ENABLED]: monitor.enabled || defaultFields[ConfigKey.ENABLED],
[ConfigKey.ENABLED]: monitor.enabled ?? defaultFields[ConfigKey.ENABLED],
};
return {
...DEFAULT_FIELDS[DataStream.BROWSER],

View file

@ -629,5 +629,43 @@ export default function ({ getService }: FtrProviderContext) {
]);
}
});
it('project monitors - is able to enable and disable monitors', async () => {
try {
await supertest
.put(API_URLS.SYNTHETICS_MONITORS_PROJECT)
.set('kbn-xsrf', 'true')
.send(projectMonitors);
await supertest
.put(API_URLS.SYNTHETICS_MONITORS_PROJECT)
.set('kbn-xsrf', 'true')
.send({
...projectMonitors,
monitors: [
{
...projectMonitors.monitors[0],
enabled: false,
},
],
})
.expect(200);
const response = await supertest
.get(API_URLS.SYNTHETICS_MONITORS)
.query({
filter: `${syntheticsMonitorType}.attributes.journey_id: ${projectMonitors.monitors[0].id}`,
})
.set('kbn-xsrf', 'true')
.expect(200);
const { monitors } = response.body;
expect(monitors[0].attributes.enabled).eql(false);
} finally {
await Promise.all([
projectMonitors.monitors.map((monitor) => {
return deleteMonitor(monitor.id, projectMonitors.project);
}),
]);
}
});
});
}