Skip to content

Commit 8d3640f

Browse files
committed
add documentation around newly created e2e tests explaining bug and specific regression to be on the lookout for if these start failing
1 parent 2da8b71 commit 8d3640f

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_rules.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,25 @@ export default ({ getService }: FtrProviderContext) => {
6868
expect(bodyToCompare).to.eql(getSimpleRuleOutput());
6969
});
7070

71+
/*
72+
This test is to ensure no future regressions introduced by the following scenario
73+
a call to updateApiKey was invalidating the api key used by the
74+
rule while the rule was executing, or even before it executed,
75+
on the first rule run.
76+
this pr https://github.com/elastic/kibana/pull/68184
77+
fixed this by finding the true source of a bug that required the manual
78+
api key update, and removed the call to that function.
79+
80+
When the api key is updated before / while the rule is executing, the alert
81+
executor no longer has access to a service to update the rule status
82+
saved object in Elasticsearch. Because of this, we cannot set the rule into
83+
a 'failure' state, so the user ends up seeing 'going to run' as that is the
84+
last status set for the rule before it erupts in an error that cannot be
85+
recorded inside of the executor.
86+
87+
This adds an e2e test for the backend to catch that in case
88+
this pops up again elsewhere.
89+
*/
7190
it('should create a single rule with a rule_id and validate it ran successfully', async () => {
7291
const simpleRule = getSimpleRule();
7392
const { body } = await supertest

x-pack/test/detection_engine_api_integration/security_and_spaces/tests/create_rules_bulk.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ export default ({ getService }: FtrProviderContext): void => {
7171
expect(bodyToCompare).to.eql(getSimpleRuleOutput());
7272
});
7373

74+
/*
75+
This test is to ensure no future regressions introduced by the following scenario
76+
a call to updateApiKey was invalidating the api key used by the
77+
rule while the rule was executing, or even before it executed,
78+
on the first rule run.
79+
this pr https://github.com/elastic/kibana/pull/68184
80+
fixed this by finding the true source of a bug that required the manual
81+
api key update, and removed the call to that function.
82+
83+
When the api key is updated before / while the rule is executing, the alert
84+
executor no longer has access to a service to update the rule status
85+
saved object in Elasticsearch. Because of this, we cannot set the rule into
86+
a 'failure' state, so the user ends up seeing 'going to run' as that is the
87+
last status set for the rule before it erupts in an error that cannot be
88+
recorded inside of the executor.
89+
90+
This adds an e2e test for the backend to catch that in case
91+
this pops up again elsewhere.
92+
*/
7493
it('should create a single rule with a rule_id and validate it ran successfully', async () => {
7594
const simpleRule = getSimpleRule();
7695
const { body } = await supertest

x-pack/test/detection_engine_api_integration/security_and_spaces/tests/find_statuses.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,25 @@ export default ({ getService }: FtrProviderContext): void => {
4242
expect(body).to.eql({});
4343
});
4444

45+
/*
46+
This test is to ensure no future regressions introduced by the following scenario
47+
a call to updateApiKey was invalidating the api key used by the
48+
rule while the rule was executing, or even before it executed,
49+
on the first rule run.
50+
this pr https://github.com/elastic/kibana/pull/68184
51+
fixed this by finding the true source of a bug that required the manual
52+
api key update, and removed the call to that function.
53+
54+
When the api key is updated before / while the rule is executing, the alert
55+
executor no longer has access to a service to update the rule status
56+
saved object in Elasticsearch. Because of this, we cannot set the rule into
57+
a 'failure' state, so the user ends up seeing 'going to run' as that is the
58+
last status set for the rule before it erupts in an error that cannot be
59+
recorded inside of the executor.
60+
61+
This adds an e2e test for the backend to catch that in case
62+
this pops up again elsewhere.
63+
*/
4564
it('should return a single rule status when a single rule is loaded from a find status with defaults added', async () => {
4665
// add a single rule
4766
const { body: resBody } = await supertest

0 commit comments

Comments
 (0)