-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Transforms: Add ability to delete dest index & index pattern when deleting transform job #67922
Merged
qn895
merged 19 commits into
elastic:master
from
qn895:transform-delete-index-when-del-job
Jun 10, 2020
Merged
[ML] Transforms: Add ability to delete dest index & index pattern when deleting transform job #67922
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9a72929
[Transform] Add ability to delete dest index & index pattern when del…
qn895 a9620c6
[Transform] Combine success messages when deleting job transforms
qn895 f2d672b
[Transform] Change preview text length to 50
qn895 1e6bd0c
[Transform] Add API integration tests for delete_transforms
qn895 b32b884
[Transform] Update tests and fix i18n duplicates
qn895 90a2d5e
[Transform] Update bulk delete messages
qn895 d87248d
[Transform] Update tests
qn895 d3c37b5
[Transform] Rename transform job -> transform, fix ts
qn895 ec3acd3
[Transform] Add await to userCanDelete callback
qn895 1269b1d
[Transform] Remove .toLowerCase check in getIP
qn895 47ec2cc
Merge remote-tracking branch 'upstream/master' into transform-delete-…
qn895 d8f901c
[Transform] Update tests to include waitForIndicesToExist
qn895 cd293f2
[Transform] Refactor delete transform schema
qn895 8e7b21a
[Transform] Add spacer, rename indices,
qn895 def2ccf
[Transform] Refactor new IndexService
qn895 d340b35
Merge remote-tracking branch 'upstream/master' into transform-delete-…
qn895 f2b70fb
[Transform] Extend MLResponseError in extractErrorMessage
qn895 a5fda7f
[Transform] Add unit tests extractErrorMessage and modify type defs
qn895 6f0fc96
[Transform] Refactor extractErrorMessage to account for boom responses
qn895 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { | ||
BoomResponse, | ||
extractErrorMessage, | ||
MLCustomHttpResponseOptions, | ||
MLResponseError, | ||
} from './errors'; | ||
import { ResponseError } from 'kibana/server'; | ||
|
||
describe('ML - error message utils', () => { | ||
describe('extractErrorMessage', () => { | ||
test('returns just the error message', () => { | ||
const testMsg = 'Saved object [index-pattern/blahblahblah] not found'; | ||
|
||
const bodyWithNestedErrorMsg: MLCustomHttpResponseOptions<MLResponseError> = { | ||
body: { | ||
message: { | ||
msg: testMsg, | ||
}, | ||
}, | ||
statusCode: 404, | ||
}; | ||
expect(extractErrorMessage(bodyWithNestedErrorMsg)).toBe(testMsg); | ||
|
||
const bodyWithStringMsg: MLCustomHttpResponseOptions<MLResponseError> = { | ||
body: { | ||
msg: testMsg, | ||
}, | ||
statusCode: 404, | ||
}; | ||
expect(extractErrorMessage(bodyWithStringMsg)).toBe(testMsg); | ||
|
||
const bodyWithStringMessage: MLCustomHttpResponseOptions<ResponseError> = { | ||
body: { | ||
message: testMsg, | ||
}, | ||
statusCode: 404, | ||
}; | ||
expect(extractErrorMessage(bodyWithStringMessage)).toBe(testMsg); | ||
|
||
const bodyWithString: MLCustomHttpResponseOptions<ResponseError> = { | ||
body: testMsg, | ||
statusCode: 404, | ||
}; | ||
expect(extractErrorMessage(bodyWithString)).toBe(testMsg); | ||
|
||
const bodyWithError: MLCustomHttpResponseOptions<ResponseError> = { | ||
body: new Error(testMsg), | ||
statusCode: 404, | ||
}; | ||
expect(extractErrorMessage(bodyWithError)).toBe(testMsg); | ||
|
||
const bodyWithBoomError: MLCustomHttpResponseOptions<BoomResponse> = { | ||
statusCode: 404, | ||
body: { | ||
data: [], | ||
isBoom: true, | ||
isServer: false, | ||
output: { | ||
statusCode: 404, | ||
payload: { | ||
statusCode: 404, | ||
error: testMsg, | ||
message: testMsg, | ||
}, | ||
headers: {}, | ||
}, | ||
}, | ||
}; | ||
expect(extractErrorMessage(bodyWithBoomError)).toBe(testMsg); | ||
}); | ||
}); | ||
}); |
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 was deleted.
Oops, something went wrong.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function contains plenty of
if
statements, worth to covert with unit tests and provide a better typingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this an a follow up PR