-
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
Notify the response ops when there is change on connector config #175981
Notify the response ops when there is change on connector config #175981
Conversation
…into 175018-check-connector-changes
/ci |
Pinging @elastic/response-ops (Team:ResponseOps) |
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.
Verified code, left minor comments 👍
}; | ||
}); | ||
|
||
const connectorTypes: string[] = [ |
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.
nit: Could you please move this connectorTypes
to a mock file?
This will make sure there is only one source of truth and you can add new connectorType
to it in the future without worrying to add it in different test files.
}); | ||
|
||
test('ensure connector types list up to date', () => { | ||
expect(connectorTypes).toEqual(actionTypeRegistry.getAllTypes()); |
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.
Ahh okay, test will fail if new connectorType
not added. 👍
Still mock file could be useful if connectorTypes
used in multiple test files. Up to you 🙂
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.
Added :)
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.
LGTM. Just one question about type. Verified test fails if change is made to connector type schema
schema: { | ||
validate(value: unknown): Type; | ||
validate(value: unknown): T; | ||
getSchema?: () => AnySchema; |
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.
Why is this typed as optional?
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.
I changed it then remembered why i did it so.
1- SubActionsConnectorType converts its definition to ConnectorType def and misses that field (We can fix this I think)
2- There are hundreds of tests cases with ActionType mock without this filed :) And we are using it only in this test, so i made it optional.
Can we make a followup issue for this? |
Done: #177025 |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @ersin-erdal |
Reverts changes in #175981
…stic#175981) Resolves: elastic#175018 This Pr adds an integration test to check the changes on connectorTypes config, secrets and params schemas. I used `validate.schema` field as all the connector types have it. ConnectorTypes has config, secrets and params schemas on `validate.schema` whereas SubActionConnectorTypes has only config and secrets. They have multiple params schema as well but only registered and used during action execution. e.g. https://github.com/ersin-erdal/kibana/blob/main/x-pack/plugins/stack_connectors/server/connector_types/bedrock/bedrock.ts#L57 And here is the explanation why they are not listed in a definition: https://github.com/ersin-erdal/kibana/blob/main/x-pack/plugins/actions/server/sub_action_framework/validators.ts#L38 We need to do some refactoring to list those schemas on the connector types. --------- Co-authored-by: kibanamachine <[email protected]>
Reverts changes in elastic#175981
Resolves: #175018
This Pr adds an integration test to check the changes on connectorTypes config, secrets and params schemas.
I used
validate.schema
field as all the connector types have it.ConnectorTypes has config, secrets and params schemas on
validate.schema
whereas SubActionConnectorTypes has only config and secrets.They have multiple params schema as well but only registered and used during action execution.
e.g. https://github.com/ersin-erdal/kibana/blob/main/x-pack/plugins/stack_connectors/server/connector_types/bedrock/bedrock.ts#L57
And here is the explanation why they are not listed in a definition:
https://github.com/ersin-erdal/kibana/blob/main/x-pack/plugins/actions/server/sub_action_framework/validators.ts#L38
We need to do some refactoring to list those schemas on the connector types.