forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Response Ops][Task Manager] Changing task manager `schedule.interval…
…` schema to string from duration (elastic#204413) ## Summary Currently, when task manager schema changes are migrated down (which can occur during a release when there are multiple Kibana nodes running and they get updated one after another), we are running into this bug: elastic#204395 where the task `schedule.interval` gets mutated from expected values (like `60s`) to unallowed (but still valid for the schema) values (like `PT1M`). This changes the schema for `schedule.interval` to use a string with validation function. ## To verify 1. Run Kibana on `main` and create some rules that run frequently. 2. "Upgrade" to this PR branch and verify that rules continue to run. 3. "Downgrade" back to `main` and verify that rules continue to run.
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/task_manager/server/saved_objects/schemas/task.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { validateDuration } from './task'; | ||
|
||
test('allows valid duration', () => { | ||
expect(validateDuration('1s')).toBeUndefined(); | ||
expect(validateDuration('45346s')).toBeUndefined(); | ||
expect(validateDuration('10m')).toBeUndefined(); | ||
expect(validateDuration('30000000h')).toBeUndefined(); | ||
expect(validateDuration('3245d')).toBeUndefined(); | ||
}); | ||
|
||
test('returns error message for invalid duration', () => { | ||
expect(validateDuration('10x')).toBe('string is not a valid duration: 10x'); | ||
expect(validateDuration('PT1M')).toBe('string is not a valid duration: PT1M'); | ||
expect(validateDuration('foo')).toBe('string is not a valid duration: foo'); | ||
expect(validateDuration('1 minute')).toBe('string is not a valid duration: 1 minute'); | ||
expect(validateDuration('1hr')).toBe('string is not a valid duration: 1hr'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters