Added check for destinations
What does this MR do and why?
Adds check whether the given destinationId for destroy and update is valid or not, if not then raise error.
How to set up and validate locally
- Enable feature flag in rails console by running
::Feature.enabled?(:ff_external_audit_events)
. - Login as instance admin user on http://127.0.0.1:3000/.
- Go to http://127.0.0.1:3000/-/graphql-explorer
- List all the instance level external audit event destinations by running following query in the explorer.
query {
instanceExternalAuditEventDestinations {
nodes {
id
destinationUrl
verificationToken
}
}
}
- Run the following mutation in the explorer to destroy non existent destination and use a id such as it is not present in the destinations recieved in step 4. (I am adding id as 555, pretty huge number for that, for which it is likely it would be present in that list.)
mutation {
instanceExternalAuditEventDestinationDestroy(input: { id: "gid://gitlab/AuditEvents::InstanceExternalAuditEventDestination/555"}) {
errors
}
}
- The output should be an error with message "Please provide a valid destinationId."
- Run the following mutation in the explorer to update a non destination, similar to step 5, I am using id 555 assuming it would be non-existent.
mutation {
instanceExternalAuditEventDestinationUpdate(input: { id: "gid://gitlab/AuditEvents::InstanceExternalAuditEventDestination/555",destinationUrl: "https://www.example200.com"}) {
errors
instanceExternalAuditEventDestination {
destinationUrl
id
verificationToken
}
}
}
- The output will again contain error with message "Please provide a valid destinationId."
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #413624 (closed)
Edited by Hitesh Raghuvanshi