Skip to content

Commit 8c87366

Browse files
committed
Make tests deterministic by providing unique timestamps (elastic#93350)
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 dd8f63e commit 8c87366

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,21 @@ export default ({ getService }: FtrProviderContext) => {
600600
},
601601
{
602602
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+
},
603618
{
604619
description: "domain should match the auditbeat hosts' data's source.ip",
605620
domain: '159.89.119.67',
@@ -618,21 +633,6 @@ export default ({ getService }: FtrProviderContext) => {
618633
scheme: 'http',
619634
},
620635
},
621-
{
622-
description: 'this should match auditbeat/hosts on both port and ip',
623-
first_seen: '2021-01-26T11:06:03.000Z',
624-
ip: '45.115.45.3',
625-
matched: {
626-
atomic: '45.115.45.3',
627-
id: '978785',
628-
index: 'filebeat-8.0.0-2021.01.26-000001',
629-
field: 'source.ip',
630-
type: 'url',
631-
},
632-
port: 57324,
633-
provider: 'geenensp',
634-
type: 'url',
635-
},
636636
{
637637
description: 'this should match auditbeat/hosts on both port and ip',
638638
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)