Commit ec21bd5
[Osquery] Add Scout API tests for saved queries, packs, and response actions (elastic#258534)
This PR adds initial Scout API tests for the Osquery platform plugin.
This is a very early step towards breaking down the wonderful work
started by PR elastic#252216 in multiple
easy-to-review pieces, while still ensuring the tests follow Scout's
[best
practices](https://www.elastic.co/docs/extend/kibana/scout/best-practices).
Note that some of the Cypress tests intercept API calls, which we
usually don't recommend doing (a dedicated Scout API test ensure an
isolated + clear testing environment).
These API tests tests cover saved queries, packs, and detection rule
response actions with RBAC permission boundaries so UI tests don't have
to intercept these calls or verify this data correctness behavior.
These are 7 new Scout API tests. Exact breakdown details available
below.
### Coverage Parity Report
| Scout spec | Focus | Migrated from FTR? |
|---|---|---|
| `packs_admin.spec.ts` | Profile UID on create/find | Yes (from
`packs.ts`) |
| `packs_editor.spec.ts` | Packs CRUD, multi-query, search/filter | Yes
(from `packs.ts`) |
| `packs_viewer.spec.ts` | RBAC: read allowed, write denied | **New** |
| `saved_queries_admin.spec.ts` | Profile UID on create/read/find | Yes
(from `saved_queries.ts`) |
| `saved_queries_editor.spec.ts` | Saved queries CRUD, search/filter |
Yes (from `saved_queries.ts`) |
| `saved_queries_viewer.spec.ts` | RBAC: read allowed, write denied |
**New** |
| `response_actions_rules.spec.ts` | Detection rules with osquery
actions | **New** |
### FTR tests still remaining (6 files) -- NOT migrated
| FTR file | Tests | API type | Migration notes |
|---|---|---|---|
| `packs.ts` (2 remaining) | Fleet config multi-line/single-line query
format | Internal + Fleet | Requires Fleet agent/package policy setup;
consider migrating if Scout supports Fleet fixtures |
| `assets.ts` | Prebuilt pack assets status, install/update | Internal
(`/internal/osquery/assets`) | Good candidate for Scout migration |
| `fleet_wrapper.ts` | 7 Fleet wrapper endpoints (agents, policies,
package policies) | Internal (`/internal/osquery/fleet_wrapper/*`) |
Requires Fleet agent enrollment; depends on `fleetAndAgents` FTR service
|
| `privileges_check.ts` | Superuser privileges check | Internal
(`/internal/osquery/privileges_check`) | Simple test, easy to migrate |
| `status.ts` | Osquery installation status | Internal
(`/internal/osquery/status`) | Requires osquery package install;
moderate to migrate |
| `live_queries.ts` | Live query details and results | Public
(`/api/osquery/live_queries`) | Uses ES directly to seed action docs;
moderate to migrate |
| `history_tags.ts` | 17 tag CRUD tests + aggregation + validation |
Public + Internal (`/api/osquery/history`,
`/internal/osquery/history/tags`) | Large test suite; uses ES directly
for action/response docs; good candidate but substantial effort |
### Follow-ups
Further PRs will focus on migrating some of the Cypress tests. This
initial PR is a way for me / the team to get acquainted with Osquery /
ensure we have some very early (though for now limited) Scout coverage.
Feedback welcome!
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>1 parent 5c2278f commit ec21bd5
16 files changed
Lines changed: 1278 additions & 162 deletions
File tree
- .buildkite
- x-pack/platform
- test/api_integration/apis/osquery
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
0 commit comments