-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Beats Management] add more tests, update types, break out ES into it…
…'s own adapter (#20566) * inital effort to move to JWT and added jest based tests on libs * assign beats tests all passing * token tests now pass * add more tests * all tests now green * move enrollment token back to a hash * remove un-needed comment * alias lodash get to avoid confusion * isolated hash creation * Add initial efforts for backend framework adapter testing * move ES code to a DatabaseAdapter from BackendAdapter and add a TON of types for ES * re-typed * renamed types to match pattern * aditional renames * adapter tests should always just use adapterSetup(); * database now uses InternalRequest * corrected spelling of framework * fix typings * remove CRUFT * RequestOrInternal * Dont pass around request objects everywhere, just pass the user. Also, removed hapi types as they were not compatible * fix tests, add test, removed extra comment * fix auth * updated lock file
- Loading branch information
1 parent
f130bbe
commit 01c648a
Showing
45 changed files
with
1,161 additions
and
551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { ConfigurationBlockTypes } from './constants'; | ||
|
||
export interface ConfigurationBlock { | ||
type: ConfigurationBlockTypes; | ||
block_yml: string; | ||
} | ||
|
||
export interface CMBeat { | ||
id: string; | ||
access_token: string; | ||
verified_on?: string; | ||
type: string; | ||
version?: string; | ||
host_ip: string; | ||
host_name: string; | ||
ephemeral_id?: string; | ||
local_configuration_yml?: string; | ||
tags?: string[]; | ||
central_configuration_yml?: string; | ||
metadata?: {}; | ||
} | ||
|
||
export interface BeatTag { | ||
id: string; | ||
configuration_blocks: ConfigurationBlock[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
# Documentation for Beats CM in x-pack kibana | ||
|
||
### Run tests | ||
### Run tests (from x-pack dir) | ||
|
||
Functional tests | ||
|
||
``` | ||
node scripts/jest.js plugins/beats --watch | ||
``` | ||
|
||
Functional API tests | ||
|
||
``` | ||
node scripts/functional_tests --config test/api_integration/config | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
x-pack/plugins/beats/server/lib/adapters/beats/adapter_types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { CMBeat } from '../../../../common/domain_types'; | ||
import { FrameworkUser } from '../framework/adapter_types'; | ||
|
||
// FIXME: fix getBeatsWithIds return type | ||
export interface CMBeatsAdapter { | ||
insert(beat: CMBeat): Promise<void>; | ||
update(beat: CMBeat): Promise<void>; | ||
get(id: string): any; | ||
getAll(user: FrameworkUser): any; | ||
getWithIds(user: FrameworkUser, beatIds: string[]): any; | ||
verifyBeats(user: FrameworkUser, beatIds: string[]): any; | ||
removeTagsFromBeats( | ||
user: FrameworkUser, | ||
removals: BeatsTagAssignment[] | ||
): Promise<BeatsTagAssignment[]>; | ||
assignTagsToBeats( | ||
user: FrameworkUser, | ||
assignments: BeatsTagAssignment[] | ||
): Promise<BeatsTagAssignment[]>; | ||
} | ||
|
||
export interface BeatsTagAssignment { | ||
beatId: string; | ||
tag: string; | ||
idxInRequest?: number; | ||
} | ||
|
||
interface BeatsReturnedTagAssignment { | ||
status: number | null; | ||
result?: string; | ||
} | ||
|
||
export interface CMAssignmentReturn { | ||
assignments: BeatsReturnedTagAssignment[]; | ||
} | ||
|
||
export interface BeatsRemovalReturn { | ||
removals: BeatsReturnedTagAssignment[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.