-
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
[Security Solutions] Fixes flake with cypress tests #97329
Changes from 1 commit
0675d13
6bd73d8
52f845e
16dc54d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,15 @@ | |
|
||
import { CustomRule, ThreatIndicatorRule } from '../../objects/rule'; | ||
|
||
export const createCustomRule = (rule: CustomRule, ruleId = 'rule_testing') => | ||
export const createCustomRule = (rule: CustomRule, ruleId = 'rule_testing', interval = '100m') => | ||
cy.request({ | ||
method: 'POST', | ||
url: 'api/detection_engine/rules', | ||
body: { | ||
rule_id: ruleId, | ||
risk_score: parseInt(rule.riskScore, 10), | ||
description: rule.description, | ||
interval: '10s', | ||
interval, | ||
name: rule.name, | ||
severity: rule.severity.toLocaleLowerCase(), | ||
type: 'query', | ||
|
@@ -67,15 +67,20 @@ export const createCustomIndicatorRule = (rule: ThreatIndicatorRule, ruleId = 'r | |
failOnStatusCode: false, | ||
}); | ||
|
||
export const createCustomRuleActivated = (rule: CustomRule, ruleId = '1') => | ||
export const createCustomRuleActivated = ( | ||
rule: CustomRule, | ||
ruleId = '1', | ||
interval = '100m', | ||
maxSignals = 500 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super nit: we could also leave this at default 100 and just change the max_signals test to be 500. Not sure if it's that big a deal. I just figure most aren't going to be playing around with the max_signals knob. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's true. I don't think it's that big of a deal. If we start refactoring code and it gets worse or we hit more flakes then yeah I will for sure do it. Thanks for the suggestion. |
||
) => | ||
cy.request({ | ||
method: 'POST', | ||
url: 'api/detection_engine/rules', | ||
body: { | ||
rule_id: ruleId, | ||
risk_score: parseInt(rule.riskScore, 10), | ||
description: rule.description, | ||
interval: '10s', | ||
interval, | ||
name: rule.name, | ||
severity: rule.severity.toLocaleLowerCase(), | ||
type: 'query', | ||
|
@@ -85,7 +90,7 @@ export const createCustomRuleActivated = (rule: CustomRule, ruleId = '1') => | |
language: 'kuery', | ||
enabled: true, | ||
tags: ['rule1'], | ||
max_signals: 500, | ||
max_signals: maxSignals, | ||
}, | ||
headers: { 'kbn-xsrf': 'cypress-creds' }, | ||
failOnStatusCode: false, | ||
|
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 isn't the
interval
here${jsonrule.interval}
since this isn't hardcoded anymore?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.
That I don't know. There's a lot of parts of this that don't use it. I think that's intentional.
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.
Guess what I'm saying is I don't want to change that part right now unless I need to ;-)