Skip to content

Commit fe6af8e

Browse files
committed
Make tests deterministic by providing unique timestamps
The threat intel data that we are loading for these tests was previously copy/pasted, resulting in all docs having the same @timestamp value. This resulted in nondeterministic ordering which manifested as test failures. This fixes the issue by giving a unique timestamp to each indicator document, and then unskips/updates tests according to this new ordering.
1 parent 4218813 commit fe6af8e

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

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

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ export default ({ getService }: FtrProviderContext) => {
3535
/**
3636
* Specific api integration tests for threat matching rule type
3737
*/
38-
// FLAKY: https://github.com/elastic/kibana/issues/93152
39-
describe.skip('create_threat_matching', () => {
38+
describe('create_threat_matching', () => {
4039
describe('validation errors', () => {
4140
it('should give an error that the index must exist first if it does not exist before creating a rule', async () => {
4241
const { body } = await supertest
@@ -601,6 +600,21 @@ export default ({ getService }: FtrProviderContext) => {
601600
},
602601
{
603602
indicator: [
603+
{
604+
description: 'this should match auditbeat/hosts on both port and ip',
605+
first_seen: '2021-01-26T11:06:03.000Z',
606+
ip: '45.115.45.3',
607+
matched: {
608+
atomic: '45.115.45.3',
609+
id: '978785',
610+
index: 'filebeat-8.0.0-2021.01.26-000001',
611+
field: 'source.ip',
612+
type: 'url',
613+
},
614+
port: 57324,
615+
provider: 'geenensp',
616+
type: 'url',
617+
},
604618
{
605619
description: "domain should match the auditbeat hosts' data's source.ip",
606620
domain: '159.89.119.67',
@@ -619,21 +633,6 @@ export default ({ getService }: FtrProviderContext) => {
619633
scheme: 'http',
620634
},
621635
},
622-
{
623-
description: 'this should match auditbeat/hosts on both port and ip',
624-
first_seen: '2021-01-26T11:06:03.000Z',
625-
ip: '45.115.45.3',
626-
matched: {
627-
atomic: '45.115.45.3',
628-
id: '978785',
629-
index: 'filebeat-8.0.0-2021.01.26-000001',
630-
field: 'source.ip',
631-
type: 'url',
632-
},
633-
port: 57324,
634-
provider: 'geenensp',
635-
type: 'url',
636-
},
637636
{
638637
description: 'this should match auditbeat/hosts on both port and ip',
639638
first_seen: '2021-01-26T11:06:03.000Z',

x-pack/test/functional/es_archives/filebeat/threat_intel/data.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"id": "978783",
55
"index": "filebeat-8.0.0-2021.01.26-000001",
66
"source": {
7-
"@timestamp": "2021-01-26T11:09:05.529Z",
7+
"@timestamp": "2021-01-26T11:09:00.000Z",
88
"agent": {
99
"ephemeral_id": "b7b56c3e-1f27-4c69-96f4-aa9ca47888d0",
1010
"id": "69acb5f0-1e79-4cfe-a4dc-e0dbf229ff51",
@@ -73,7 +73,7 @@
7373
"id": "978784",
7474
"index": "filebeat-8.0.0-2021.01.26-000001",
7575
"source": {
76-
"@timestamp": "2021-01-26T11:09:05.529Z",
76+
"@timestamp": "2021-01-26T11:09:01.000Z",
7777
"agent": {
7878
"ephemeral_id": "b7b56c3e-1f27-4c69-96f4-aa9ca47888d0",
7979
"id": "69acb5f0-1e79-4cfe-a4dc-e0dbf229ff51",
@@ -142,7 +142,7 @@
142142
"id": "978785",
143143
"index": "filebeat-8.0.0-2021.01.26-000001",
144144
"source": {
145-
"@timestamp": "2021-01-26T11:09:05.529Z",
145+
"@timestamp": "2021-01-26T11:09:02.000Z",
146146
"agent": {
147147
"ephemeral_id": "b7b56c3e-1f27-4c69-96f4-aa9ca47888d0",
148148
"id": "69acb5f0-1e79-4cfe-a4dc-e0dbf229ff51",
@@ -212,7 +212,7 @@
212212
"id": "978787",
213213
"index": "filebeat-8.0.0-2021.01.26-000001",
214214
"source": {
215-
"@timestamp": "2021-01-26T11:09:05.529Z",
215+
"@timestamp": "2021-01-26T11:09:03.000Z",
216216
"agent": {
217217
"ephemeral_id": "b7b56c3e-1f27-4c69-96f4-aa9ca47888d0",
218218
"id": "69acb5f0-1e79-4cfe-a4dc-e0dbf229ff51",

0 commit comments

Comments
 (0)