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.
[ML] Transforms: use health information for alerting rule (elastic#15…
- Loading branch information
1 parent
0f1c4e0
commit d339b75
Showing
12 changed files
with
325 additions
and
70 deletions.
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
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
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,108 @@ | ||
/* | ||
* 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 { getResultTestConfig } from './alerts'; | ||
|
||
describe('getResultTestConfig', () => { | ||
test('provides default config for new rule', () => { | ||
expect(getResultTestConfig(undefined)).toEqual({ | ||
healthCheck: { | ||
enabled: true, | ||
}, | ||
notStarted: { | ||
enabled: true, | ||
}, | ||
errorMessages: { | ||
enabled: false, | ||
}, | ||
}); | ||
}); | ||
|
||
test('provides config for rule created with default settings', () => { | ||
expect(getResultTestConfig(null)).toEqual({ | ||
healthCheck: { | ||
enabled: true, | ||
}, | ||
notStarted: { | ||
enabled: true, | ||
}, | ||
errorMessages: { | ||
enabled: false, | ||
}, | ||
}); | ||
}); | ||
|
||
test('completes already defined config', () => { | ||
expect( | ||
getResultTestConfig({ | ||
healthCheck: null, | ||
notStarted: null, | ||
errorMessages: { | ||
enabled: false, | ||
}, | ||
}) | ||
).toEqual({ | ||
healthCheck: { | ||
enabled: false, | ||
}, | ||
notStarted: { | ||
enabled: true, | ||
}, | ||
errorMessages: { | ||
enabled: false, | ||
}, | ||
}); | ||
}); | ||
|
||
test('sets healthCheck based on the errorMessages', () => { | ||
expect( | ||
getResultTestConfig({ | ||
healthCheck: null, | ||
notStarted: null, | ||
errorMessages: { | ||
enabled: true, | ||
}, | ||
}) | ||
).toEqual({ | ||
healthCheck: { | ||
enabled: false, | ||
}, | ||
notStarted: { | ||
enabled: true, | ||
}, | ||
errorMessages: { | ||
enabled: true, | ||
}, | ||
}); | ||
}); | ||
|
||
test('preserves complete config', () => { | ||
expect( | ||
getResultTestConfig({ | ||
healthCheck: { | ||
enabled: false, | ||
}, | ||
notStarted: { | ||
enabled: true, | ||
}, | ||
errorMessages: { | ||
enabled: true, | ||
}, | ||
}) | ||
).toEqual({ | ||
healthCheck: { | ||
enabled: false, | ||
}, | ||
notStarted: { | ||
enabled: true, | ||
}, | ||
errorMessages: { | ||
enabled: true, | ||
}, | ||
}); | ||
}); | ||
}); |
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
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
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
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
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
Oops, something went wrong.