Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds tests for Enterprise Search #84

Merged
merged 5 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
246 changes: 126 additions & 120 deletions apis_report.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions tests/entsearch/10_basic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
requires:
serverless: false
stack: true
---
"Enterprise Search loaded":
- do:
cluster.state: {}
- set: { master_node: master }

- do:
nodes.info: {}
- contains: { nodes.$master.modules: { name: x-pack-ent-search } }

- do:
xpack.usage: { }
- match:
enterprise_search:
enabled: true
available: true
search_applications: { count: 0 }
analytics_collections: { count: 0 }
query_rulesets: { total_count: 0, total_rule_count: 0, min_rule_count: 0, max_rule_count: 0 }
57 changes: 57 additions & 0 deletions tests/entsearch/20_connector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
requires:
serverless: true
stack: true
---
teardown:
- do:
indices.delete:
index: connectors-test
ignore: 404
---
"Connector":
- do:
connector.put:
connector_id: test-connector-1
body:
index_name: connectors-test
- match: { result: 'created' }

- do:
connector.check_in:
connector_id: test-connector-1
- match: { result: updated }

- do:
connector.last_sync:
connector_id: test-connector-1
body:
last_sync_error: "oh no error"
last_access_control_sync_scheduled_at: "2023-05-25T12:30:00.000Z"
- match: { result: updated }

- do:
connector.get:
connector_id: test-connector-1
- match: { index_name: connectors-test }
- match: { last_sync_error: "oh no error" }
- match: { last_access_control_sync_scheduled_at: "2023-05-25T12:30:00.000Z" }

- do:
connector.list: {}
- gte: { count: 1 }

- do:
connector.post: { }
- set: { id: id }
- match: { id: $id }

- do:
connector.get:
connector_id: $id
- match: { id: $id }

- do:
connector.delete:
connector_id: test-connector-1
- match: { acknowledged: true }
50 changes: 50 additions & 0 deletions tests/entsearch/30_sync_jobs_serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
requires:
serverless: true
stack: false
---
setup:
- do:
connector.put:
connector_id: test-connector
body:
index_name: sync-jobs-test
name: my-connector
language: de
is_native: false
service_type: super-connector
---
teardown:
- do:
connector.delete:
connector_id: test-connector
---
"connector.sync_jobs (serverless)":
- do:
connector.sync_job_post:
body:
id: test-connector
job_type: full
trigger_method: on_demand
- set: { id: id }
- match: { id: $id }

- do:
connector.sync_job_get:
connector_sync_job_id: $id
- match: { connector.id: test-connector }
- set: { last_seen: last_seen_before_check_in }

- do:
connector.sync_job_cancel:
connector_sync_job_id: $id
- match: { result: updated }

- do:
connector.sync_job_list: {}
- gte: { count: 1 }

- do:
connector.sync_job_delete:
connector_sync_job_id: $id
- match: { acknowledged: true }
74 changes: 74 additions & 0 deletions tests/entsearch/30_sync_jobs_stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
requires:
serverless: false
stack: true
---
setup:
- do:
connector.put:
connector_id: test-connector
body:
index_name: sync-jobs-test
name: my-connector
language: de
is_native: false
service_type: super-connector
---
"connector.sync_jobs (stack)":
- do:
connector.sync_job_post:
body:
id: test-connector
job_type: full
trigger_method: on_demand
- set: { id: id }
- match: { id: $id }

- do:
connector.sync_job_get:
connector_sync_job_id: $id
- match: { connector.id: test-connector }
- set: { last_seen: last_seen_before_check_in }

- do:
connector.sync_job_check_in:
connector_sync_job_id: $id
- match: { result: updated }

- do:
connector.sync_job_cancel:
connector_sync_job_id: $id
- match: { result: updated }

- do:
connector.sync_job_update_stats:
connector_sync_job_id: $id
body:
deleted_document_count: 10
indexed_document_count: 20
indexed_document_volume: 1000

- match: { result: updated }

- do:
connector.sync_job_get:
connector_sync_job_id: $id
- match: { deleted_document_count: 10 }
- match: { indexed_document_count: 20 }
- match: { indexed_document_volume: 1000 }

- do:
connector.sync_job_list: {}
- gte: { count: 1 }

- do:
connector.sync_job_claim:
connector_sync_job_id: $id
body:
worker_hostname: "host-name"
- match: { result: updated }

- do:
connector.sync_job_delete:
connector_sync_job_id: $id
- match: { acknowledged: true }
26 changes: 26 additions & 0 deletions tests/entsearch/40_connector_secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
requires:
serverless: false
stack: true
---
'connector secret':
- do:
connector.secret_post:
body:
value: my-secret
- set: { id: id }
- match: { id: $id }
- do:
connector.secret_get:
id: $id
- match: { value: my-secret }
- do:
connector.secret_put:
id: $id
body:
value: my-secret-2
- match: { result: 'updated' }
- do:
connector.secret_get:
id: $id
- match: { value: my-secret-2 }
Loading
Loading