Skip to content

Commit

Permalink
[8.3] [Synthetics] adjust enabled key for browser monitors (#135016)
Browse files Browse the repository at this point in the history
* synthetics - adjust enabled key for browser monitors

* Update x-pack/test/api_integration/apis/uptime/rest/add_monitor_project.ts
  • Loading branch information
dominiqueclarke authored Jun 23, 2022
1 parent 7d22cf2 commit 8a54c80
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
query: `${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);
}),
]);
}
});
});
}

0 comments on commit 8a54c80

Please sign in to comment.