Skip to content

Commit

Permalink
Merge branch '7.x' into ua/7.x/step-completion-state
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 8, 2021
2 parents 0a14a6c + cac2c82 commit 3340c42
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/dev_docs/local_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To access an elasticsearch instance that has live data you have two options:

#### A. Connect to Elasticsearch on Cloud (internal devs only)

Find the credentials for the cluster [here](https://github.com/elastic/apm-dev/blob/master/docs/credentials/apm-ui-clusters.md#apmelstcco)
Find the credentials for the cluster [here](https://github.com/elastic/observability-dev/blob/master/docs/observability-clusters.md)

#### B. Start Elastic Stack and APM data generators

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,52 @@ describe('get_filter', () => {
});
});

test('returns the query persisted to the threat_match rule, despite saved_id being specified', async () => {
const filter = await getFilter({
type: 'threat_match',
filters: undefined,
language: 'kuery',
query: 'host.name: siem',
savedId: 'some-id',
services: servicesMock,
index: ['auditbeat-*'],
lists: [],
});
expect(filter).toEqual({
bool: {
filter: [
{ bool: { minimum_should_match: 1, should: [{ match: { 'host.name': 'siem' } }] } },
],
must: [],
must_not: [],
should: [],
},
});
});

test('returns the query persisted to the threshold rule, despite saved_id being specified', async () => {
const filter = await getFilter({
type: 'threat_match',
filters: undefined,
language: 'kuery',
query: 'host.name: siem',
savedId: 'some-id',
services: servicesMock,
index: ['auditbeat-*'],
lists: [],
});
expect(filter).toEqual({
bool: {
filter: [
{ bool: { minimum_should_match: 1, should: [{ match: { 'host.name': 'siem' } }] } },
],
must: [],
must_not: [],
should: [],
},
});
});

test('throws on saved query if saved_id is undefined', async () => {
await expect(
getFilter({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ export const getFilter = async ({

switch (type) {
case 'threat_match':
case 'threshold': {
return savedId != null ? savedQueryFilter() : queryFilter();
}
case 'threshold':
case 'query': {
return queryFilter();
}
Expand Down

0 comments on commit 3340c42

Please sign in to comment.