From 35fd277b6e46cb0b10622f6364b3376cb2bf1c65 Mon Sep 17 00:00:00 2001 From: Nicolas Chaulet Date: Thu, 2 Nov 2023 13:58:00 -0400 Subject: [PATCH] Add tests --- .../generated/categories-experimental.json | 2 +- .../categories-include-policy-templates.json | 2 +- ...tegories-prerelease-capabilities-none.json | 2 +- ...e-capabilities-observability-security.json | 2 +- testdata/generated/categories-prerelease.json | 2 +- .../generated/categories-spec-max-2.10.0.json | 2 +- testdata/generated/categories.json | 2 +- .../package/agent_privileges/1.0.0/index.json | 47 ++++++++ .../package/example/1.2.0/index.json | 109 ++++++++++++++++++ testdata/generated/search-all-proxy.json | 18 +++ testdata/generated/search-all.json | 18 +++ .../generated/search-category-custom.json | 18 +++ .../generated/search-just-latest-proxy.json | 18 +++ testdata/generated/search-kibana800.json | 18 +++ .../search-package-experimental.json | 18 +++ .../generated/search-package-internal.json | 18 +++ .../generated/search-package-prerelease.json | 18 +++ .../search-prerelease-capabilities-none.json | 18 +++ ...e-capabilities-observability-security.json | 18 +++ .../generated/search-spec-max-2.10.0.json | 18 +++ testdata/generated/search.json | 18 +++ .../agent_privileges/fields/base-fields.yml | 16 +++ .../data_stream/agent_privileges/manifest.yml | 5 + .../agent_privileges/1.0.0/docs/README.md | 0 .../agent_privileges/1.0.0/manifest.yml | 17 +++ 25 files changed, 417 insertions(+), 7 deletions(-) create mode 100644 testdata/generated/package/agent_privileges/1.0.0/index.json create mode 100644 testdata/generated/package/example/1.2.0/index.json create mode 100644 testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/fields/base-fields.yml create mode 100644 testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/manifest.yml create mode 100644 testdata/package/agent_privileges/1.0.0/docs/README.md create mode 100644 testdata/package/agent_privileges/1.0.0/manifest.yml diff --git a/testdata/generated/categories-experimental.json b/testdata/generated/categories-experimental.json index 22db3e84e..3187dc826 100644 --- a/testdata/generated/categories-experimental.json +++ b/testdata/generated/categories-experimental.json @@ -27,7 +27,7 @@ { "id": "custom", "title": "Custom", - "count": 16 + "count": 17 }, { "id": "datastore", diff --git a/testdata/generated/categories-include-policy-templates.json b/testdata/generated/categories-include-policy-templates.json index f27d52973..9d41bb64f 100644 --- a/testdata/generated/categories-include-policy-templates.json +++ b/testdata/generated/categories-include-policy-templates.json @@ -12,7 +12,7 @@ { "id": "custom", "title": "Custom", - "count": 13 + "count": 14 }, { "id": "datastore", diff --git a/testdata/generated/categories-prerelease-capabilities-none.json b/testdata/generated/categories-prerelease-capabilities-none.json index ca6754956..22db3e84e 100644 --- a/testdata/generated/categories-prerelease-capabilities-none.json +++ b/testdata/generated/categories-prerelease-capabilities-none.json @@ -27,7 +27,7 @@ { "id": "custom", "title": "Custom", - "count": 15 + "count": 16 }, { "id": "datastore", diff --git a/testdata/generated/categories-prerelease-capabilities-observability-security.json b/testdata/generated/categories-prerelease-capabilities-observability-security.json index 03fda81d6..c924a6a66 100644 --- a/testdata/generated/categories-prerelease-capabilities-observability-security.json +++ b/testdata/generated/categories-prerelease-capabilities-observability-security.json @@ -27,7 +27,7 @@ { "id": "custom", "title": "Custom", - "count": 15 + "count": 16 }, { "id": "datastore", diff --git a/testdata/generated/categories-prerelease.json b/testdata/generated/categories-prerelease.json index c924a6a66..5b60b59e0 100644 --- a/testdata/generated/categories-prerelease.json +++ b/testdata/generated/categories-prerelease.json @@ -27,7 +27,7 @@ { "id": "custom", "title": "Custom", - "count": 16 + "count": 17 }, { "id": "datastore", diff --git a/testdata/generated/categories-spec-max-2.10.0.json b/testdata/generated/categories-spec-max-2.10.0.json index 22db3e84e..3187dc826 100644 --- a/testdata/generated/categories-spec-max-2.10.0.json +++ b/testdata/generated/categories-spec-max-2.10.0.json @@ -27,7 +27,7 @@ { "id": "custom", "title": "Custom", - "count": 16 + "count": 17 }, { "id": "datastore", diff --git a/testdata/generated/categories.json b/testdata/generated/categories.json index 4a00fae17..73ccf40b2 100644 --- a/testdata/generated/categories.json +++ b/testdata/generated/categories.json @@ -12,7 +12,7 @@ { "id": "custom", "title": "Custom", - "count": 13 + "count": 14 }, { "id": "datastore", diff --git a/testdata/generated/package/agent_privileges/1.0.0/index.json b/testdata/generated/package/agent_privileges/1.0.0/index.json new file mode 100644 index 000000000..a6dcecac8 --- /dev/null +++ b/testdata/generated/package/agent_privileges/1.0.0/index.json @@ -0,0 +1,47 @@ +{ + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ], + "format_version": "1.0.0", + "readme": "/package/agent_privileges/1.0.0/docs/README.md", + "license": "basic", + "assets": [ + "/package/agent_privileges/1.0.0/manifest.yml", + "/package/agent_privileges/1.0.0/docs/README.md", + "/package/agent_privileges/1.0.0/data_stream/agent_privileges/manifest.yml", + "/package/agent_privileges/1.0.0/data_stream/agent_privileges/fields/base-fields.yml" + ], + "data_streams": [ + { + "type": "metrics", + "dataset": "agent_privileges.agent_privileges", + "title": "Agent privileges data stream", + "release": "beta", + "package": "agent_privileges", + "agent": { + "privileges": { + "root": true + } + }, + "path": "agent_privileges" + } + ], + "agent": { + "privileges": { + "root": true + } + } +} diff --git a/testdata/generated/package/example/1.2.0/index.json b/testdata/generated/package/example/1.2.0/index.json new file mode 100644 index 000000000..4d162de6c --- /dev/null +++ b/testdata/generated/package/example/1.2.0/index.json @@ -0,0 +1,109 @@ +{ + "name": "example", + "title": "Example Integration", + "version": "1.2.0", + "release": "ga", + "source": { + "license": "Elastic-2.0" + }, + "description": "This is the example integration", + "type": "integration", + "download": "/epr/example/example-1.2.0.zip", + "path": "/package/example/1.2.0", + "conditions": { + "kibana": { + "version": "^7.16.0 || ^8.0.0" + }, + "elastic": { + "subscription": "gold", + "capabilities": [ + "security" + ] + } + }, + "owner": { + "github": "ruflin" + }, + "categories": [ + "crm", + "azure", + "cloud" + ], + "format_version": "1.0.0", + "readme": "/package/example/1.2.0/docs/README.md", + "license": "gold", + "screenshots": [ + { + "src": "/img/kibana-envoyproxy.jpg", + "path": "/package/example/1.2.0/img/kibana-envoyproxy.jpg", + "title": "IP Tables Ubiquity Dashboard", + "size": "1492x1464", + "type": "image/png" + } + ], + "assets": [ + "/package/example/1.2.0/manifest.yml", + "/package/example/1.2.0/docs/README.md", + "/package/example/1.2.0/img/icon.png", + "/package/example/1.2.0/img/kibana-envoyproxy.jpg", + "/package/example/1.2.0/data_stream/foo/manifest.yml", + "/package/example/1.2.0/kibana/dashboard/0c610510-5cbd-11e9-8477-077ec9664dbd.json", + "/package/example/1.2.0/kibana/visualization/0a994af0-5c9d-11e9-8477-077ec9664dbd.json", + "/package/example/1.2.0/kibana/visualization/36f872a0-5c03-11e9-85b4-19d0072eb4f2.json", + "/package/example/1.2.0/kibana/visualization/38f96190-5c99-11e9-8477-077ec9664dbd.json", + "/package/example/1.2.0/kibana/visualization/7e4084e0-5c99-11e9-8477-077ec9664dbd.json", + "/package/example/1.2.0/kibana/visualization/80844540-5c97-11e9-8477-077ec9664dbd.json", + "/package/example/1.2.0/kibana/visualization/ab48c3f0-5ca6-11e9-8477-077ec9664dbd.json", + "/package/example/1.2.0/data_stream/foo/fields/base-fields.yml", + "/package/example/1.2.0/data_stream/foo/agent/stream/stream.yml.hbs", + "/package/example/1.2.0/data_stream/foo/elasticsearch/ingest_pipeline/pipeline-entry.json", + "/package/example/1.2.0/data_stream/foo/elasticsearch/ingest_pipeline/pipeline-http.json", + "/package/example/1.2.0/data_stream/foo/elasticsearch/ingest_pipeline/pipeline-json.json", + "/package/example/1.2.0/data_stream/foo/elasticsearch/ingest_pipeline/pipeline-plaintext.json", + "/package/example/1.2.0/data_stream/foo/elasticsearch/ingest_pipeline/pipeline-tcp.json" + ], + "policy_templates": [ + { + "name": "logs", + "title": "Logs datasource", + "description": "Datasource for your log files.", + "inputs": [ + { + "type": "foo" + } + ], + "multiple": true, + "categories": [ + "datastore" + ] + } + ], + "data_streams": [ + { + "type": "logs", + "dataset": "example.foo", + "title": "Foo", + "release": "ga", + "ingest_pipeline": "pipeline-entry", + "streams": [ + { + "input": "foo", + "vars": [ + { + "name": "paths", + "type": "text", + "description": "Path to log files to be collected", + "multi": true, + "required": true, + "show_user": false + } + ], + "template_path": "stream.yml.hbs", + "enabled": true + } + ], + "package": "example", + "path": "foo" + } + ] +} diff --git a/testdata/generated/search-all-proxy.json b/testdata/generated/search-all-proxy.json index 507f5d054..91b71ac23 100644 --- a/testdata/generated/search-all-proxy.json +++ b/testdata/generated/search-all-proxy.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datasources", "title": "Default datasource Integration", diff --git a/testdata/generated/search-all.json b/testdata/generated/search-all.json index 7c0b4dea0..30ce9c3ad 100644 --- a/testdata/generated/search-all.json +++ b/testdata/generated/search-all.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datasources", "title": "Default datasource Integration", diff --git a/testdata/generated/search-category-custom.json b/testdata/generated/search-category-custom.json index 2a7b454cf..a6cf32c68 100644 --- a/testdata/generated/search-category-custom.json +++ b/testdata/generated/search-category-custom.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datasources", "title": "Default datasource Integration", diff --git a/testdata/generated/search-just-latest-proxy.json b/testdata/generated/search-just-latest-proxy.json index e69e9bd90..646f9f420 100644 --- a/testdata/generated/search-just-latest-proxy.json +++ b/testdata/generated/search-just-latest-proxy.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datasources", "title": "Default datasource Integration", diff --git a/testdata/generated/search-kibana800.json b/testdata/generated/search-kibana800.json index 52ea5ef5c..6a40f0da6 100644 --- a/testdata/generated/search-kibana800.json +++ b/testdata/generated/search-kibana800.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datasources", "title": "Default datasource Integration", diff --git a/testdata/generated/search-package-experimental.json b/testdata/generated/search-package-experimental.json index 3455710c8..a66b311f0 100644 --- a/testdata/generated/search-package-experimental.json +++ b/testdata/generated/search-package-experimental.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datastream_without_release", "title": "Apache Spark", diff --git a/testdata/generated/search-package-internal.json b/testdata/generated/search-package-internal.json index 6c29ed535..e45034174 100644 --- a/testdata/generated/search-package-internal.json +++ b/testdata/generated/search-package-internal.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datasources", "title": "Default datasource Integration", diff --git a/testdata/generated/search-package-prerelease.json b/testdata/generated/search-package-prerelease.json index f4f37e219..06ffc653a 100644 --- a/testdata/generated/search-package-prerelease.json +++ b/testdata/generated/search-package-prerelease.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datastream_without_release", "title": "Apache Spark", diff --git a/testdata/generated/search-prerelease-capabilities-none.json b/testdata/generated/search-prerelease-capabilities-none.json index dfc9c8aa5..d1afa8fe2 100644 --- a/testdata/generated/search-prerelease-capabilities-none.json +++ b/testdata/generated/search-prerelease-capabilities-none.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datastream_without_release", "title": "Apache Spark", diff --git a/testdata/generated/search-prerelease-capabilities-observability-security.json b/testdata/generated/search-prerelease-capabilities-observability-security.json index 67750f0f6..2048676d9 100644 --- a/testdata/generated/search-prerelease-capabilities-observability-security.json +++ b/testdata/generated/search-prerelease-capabilities-observability-security.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datastream_without_release", "title": "Apache Spark", diff --git a/testdata/generated/search-spec-max-2.10.0.json b/testdata/generated/search-spec-max-2.10.0.json index 3455710c8..a66b311f0 100644 --- a/testdata/generated/search-spec-max-2.10.0.json +++ b/testdata/generated/search-spec-max-2.10.0.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datastream_without_release", "title": "Apache Spark", diff --git a/testdata/generated/search.json b/testdata/generated/search.json index 6c29ed535..e45034174 100644 --- a/testdata/generated/search.json +++ b/testdata/generated/search.json @@ -1,4 +1,22 @@ [ + { + "name": "agent_privileges", + "title": "Agent Privileges", + "version": "1.0.0", + "release": "beta", + "description": "Test package-specified agent privileges", + "type": "solution", + "download": "/epr/agent_privileges/agent_privileges-1.0.0.zip", + "path": "/package/agent_privileges/1.0.0", + "conditions": { + "kibana": { + "version": ">=7.16.0" + } + }, + "categories": [ + "custom" + ] + }, { "name": "datasources", "title": "Default datasource Integration", diff --git a/testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/fields/base-fields.yml b/testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/fields/base-fields.yml new file mode 100644 index 000000000..c40df14f9 --- /dev/null +++ b/testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/fields/base-fields.yml @@ -0,0 +1,16 @@ +- name: data_stream.type + type: constant_keyword + description: > + Data stream type. +- name: data_stream.dataset + type: constant_keyword + description: > + Data stream dataset. +- name: data_stream.namespace + type: constant_keyword + description: > + Data stream namespace. +- name: "@timestamp" + type: date + description: > + Event timestamp. diff --git a/testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/manifest.yml b/testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/manifest.yml new file mode 100644 index 000000000..33acd9fe3 --- /dev/null +++ b/testdata/package/agent_privileges/1.0.0/data_stream/agent_privileges/manifest.yml @@ -0,0 +1,5 @@ +title: Agent privileges data stream +type: metrics +agent: + privileges: + root: true diff --git a/testdata/package/agent_privileges/1.0.0/docs/README.md b/testdata/package/agent_privileges/1.0.0/docs/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/testdata/package/agent_privileges/1.0.0/manifest.yml b/testdata/package/agent_privileges/1.0.0/manifest.yml new file mode 100644 index 000000000..ae2d0ab29 --- /dev/null +++ b/testdata/package/agent_privileges/1.0.0/manifest.yml @@ -0,0 +1,17 @@ +format_version: 1.0.0 + +name: agent_privileges +description: Test package-specified agent privileges +version: 1.0.0 +title: Agent Privileges +categories: ["custom"] +type: solution +release: beta + +agent: + privileges: + root: true + +conditions: + kibana: + version: ">=7.16.0"