-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[ResponseOps][Rules] Validate timezone in rule routes #201508
base: main
Are you sure you want to change the base?
Conversation
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
|
||
export function validateTimezone(timezone: string) { | ||
if (moment.tz.names().includes(timezone)) { | ||
if (moment.tz.zone(timezone) != null) { |
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.
moment.tz.zone
is faster than moment.tz.names().includes
.
@@ -478,6 +478,38 @@ export default function createAlertTests({ getService }: FtrProviderContext) { | |||
}); | |||
}); | |||
|
|||
it('should return 400 if the timezone of an action is not valid', async () => { |
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.
Validation already existed. I added a test to avoid bugs in the future.
@@ -182,6 +182,51 @@ export default function createUpdateTests({ getService }: FtrProviderContext) { | |||
}); | |||
}); | |||
|
|||
it('should return 400 if the timezone of an action is not valid', async () => { |
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.
Validation already existed. I added a test to avoid bugs in the future.
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.
The validations are used only in internal routes.
💔 Build Failed
Failed CI Steps
Test Failures
Metrics [docs]
Historycc @cnasikas |
Summary
This PR adds validation only for internal routes that use the
rRule
schema.Checklist