Skip to content

Commit

Permalink
[Connector APIs] Update yaml rest tests for Connector APIs (#118260) (#…
Browse files Browse the repository at this point in the history
…118651)

* [Connector API] Update yaml tests

* Update tests

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
jedrazb and elasticmachine authored Dec 13, 2024
1 parent e2b5dbe commit 3a2dc1e
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ setup:
connector.put:
connector_id: test-connector-native
body:
index_name: search-test
index_name: content-search-test
is_native: true

- match: { result: 'created' }
Expand All @@ -68,7 +68,7 @@ setup:
connector_id: test-connector-native

- match: { id: test-connector-native }
- match: { index_name: search-test }
- match: { index_name: content-search-test }
- match: { is_native: true }
- match: { sync_now: false }
- match: { status: needs_configuration }
Expand Down Expand Up @@ -151,6 +151,7 @@ setup:
is_native: false
service_type: super-connector


---
'Create Connector - Id returned as part of response':
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,29 @@ setup:
connector_id: test-connector

- match: { index_name: search-1-test }


---
"Update Managed Connector Index Name":
- do:
connector.put:
connector_id: test-connector-1
body:
is_native: true
service_type: super-connector

- do:
connector.update_index_name:
connector_id: test-connector-1
body:
index_name: content-search-2-test


- match: { result: updated }

- do:
connector.get:
connector_id: test-connector-1

- match: { index_name: content-search-2-test }

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setup:
connector.put:
connector_id: test-connector
body:
index_name: search-1-test
index_name: content-search-1-test
name: my-connector
language: pl
is_native: false
Expand All @@ -29,7 +29,6 @@ setup:
connector_id: test-connector

- match: { is_native: true }
- match: { status: configured }

- do:
connector.update_native:
Expand All @@ -44,7 +43,6 @@ setup:
connector_id: test-connector

- match: { is_native: false }
- match: { status: configured }

---
"Update Connector Native - 404 when connector doesn't exist":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ setup:
- do:
connector.post:
body:
index_name: search-test
index_name: content-search-test
is_native: true

- set: { id: id }
Expand All @@ -82,7 +82,7 @@ setup:
connector_id: $id

- match: { id: $id }
- match: { index_name: search-test }
- match: { index_name: content-search-test }
- match: { is_native: true }
- match: { sync_now: false }
- match: { status: needs_configuration }
Expand All @@ -102,6 +102,7 @@ setup:
is_native: false
service_type: super-connector


---
'Create Connector - Index name used by another connector':
- do:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ setup:
connector.put:
connector_id: connector-b
body:
index_name: search-2-test
index_name: content-search-2-test
name: my-connector-2
language: en
is_native: true
Expand All @@ -40,13 +40,13 @@ setup:
- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-a" }
- match: { results.0.index_name: "search-1-test" }
- match: { results.0.language: "pl" }
- match: { results.0.id: "connector-b" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.0.language: "en" }

- match: { results.1.id: "connector-b" }
- match: { results.1.index_name: "search-2-test" }
- match: { results.1.language: "en" }
- match: { results.1.id: "connector-a" }
- match: { results.1.index_name: "search-1-test" }
- match: { results.1.language: "pl" }

- match: { results.2.id: "connector-c" }
- match: { results.2.index_name: "search-3-test" }
Expand All @@ -62,9 +62,9 @@ setup:
- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-b" }
- match: { results.0.index_name: "search-2-test" }
- match: { results.0.language: "en" }
- match: { results.0.id: "connector-a" }
- match: { results.0.index_name: "search-1-test" }
- match: { results.0.language: "pl" }

- match: { results.1.id: "connector-c" }
- match: { results.1.index_name: "search-3-test" }
Expand All @@ -79,13 +79,13 @@ setup:
- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-a" }
- match: { results.0.index_name: "search-1-test" }
- match: { results.0.language: "pl" }
- match: { results.0.id: "connector-b" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.0.language: "en" }

- match: { results.1.id: "connector-b" }
- match: { results.1.index_name: "search-2-test" }
- match: { results.1.language: "en" }
- match: { results.1.id: "connector-a" }
- match: { results.1.index_name: "search-1-test" }
- match: { results.1.language: "pl" }

---
"List Connector - empty":
Expand Down Expand Up @@ -118,11 +118,11 @@ setup:

- do:
connector.list:
index_name: search-1-test,search-2-test
index_name: search-1-test,content-search-2-test

- match: { count: 2 }
- match: { results.0.index_name: "search-1-test" }
- match: { results.1.index_name: "search-2-test" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.1.index_name: "search-1-test" }


---
Expand All @@ -147,19 +147,19 @@ setup:
connector_name: my-connector-1,my-connector-2

- match: { count: 2 }
- match: { results.0.name: "my-connector-1" }
- match: { results.1.name: "my-connector-2" }
- match: { results.0.name: "my-connector-2" }
- match: { results.1.name: "my-connector-1" }


---
"List Connector - filter by index name and name":
- do:
connector.list:
connector_name: my-connector-1,my-connector-2
index_name: search-2-test
index_name: content-search-2-test

- match: { count: 1 }
- match: { results.0.index_name: "search-2-test" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.0.name: "my-connector-2" }


Expand Down Expand Up @@ -230,13 +230,13 @@ setup:
- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-a" }
- match: { results.0.index_name: "search-1-test" }
- match: { results.0.language: "pl" }
- match: { results.0.id: "connector-b" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.0.language: "en" }

- match: { results.1.id: "connector-b" }
- match: { results.1.index_name: "search-2-test" }
- match: { results.1.language: "en" }
- match: { results.1.id: "connector-a" }
- match: { results.1.index_name: "search-1-test" }
- match: { results.1.language: "pl" }

- match: { results.2.id: "connector-c" }
- match: { results.2.index_name: "search-3-test" }
Expand All @@ -255,13 +255,13 @@ setup:
- match: { count: 3 }

# Alphabetical order by index_name for results
- match: { results.0.id: "connector-a" }
- match: { results.0.index_name: "search-1-test" }
- match: { results.0.language: "pl" }
- match: { results.0.id: "connector-b" }
- match: { results.0.index_name: "content-search-2-test" }
- match: { results.0.language: "en" }

- match: { results.1.id: "connector-b" }
- match: { results.1.index_name: "search-2-test" }
- match: { results.1.language: "en" }
- match: { results.1.id: "connector-a" }
- match: { results.1.index_name: "search-1-test" }
- match: { results.1.language: "pl" }

- match: { results.2.id: "connector-c" }
- match: { results.2.index_name: "search-3-test" }
Expand Down

0 comments on commit 3a2dc1e

Please sign in to comment.