-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the simple strategy to cluster settings (#49414)
This is related to #49067. This commit adds the simple connection strategy settings and strategy mode setting to the cluster settings registry. With these changes, the simple connection mode can be used. Additionally, it adds validation to ensure that settings cannot be misconfigured.
- Loading branch information
1 parent
51c3db1
commit 7069045
Showing
17 changed files
with
721 additions
and
102 deletions.
There are no files selected for viewing
212 changes: 212 additions & 0 deletions
212
...src/test/resources/rest-api-spec/test/multi_cluster/100_connection_mode_configuration.yml
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,212 @@ | ||
--- | ||
"Add transient remote cluster in simple mode with invalid sniff settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
catch: bad_request | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "simple" | ||
cluster.remote.test_remote_cluster.sniff.node_connections: "5" | ||
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip | ||
|
||
- match: { status: 400 } | ||
- match: { error.root_cause.0.type: "illegal_argument_exception" } | ||
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.sniff.node_connections\" cannot be | ||
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=SIMPLE]" } | ||
|
||
- do: | ||
catch: bad_request | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "simple" | ||
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip | ||
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip | ||
|
||
- match: { status: 400 } | ||
- match: { error.root_cause.0.type: "illegal_argument_exception" } | ||
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.sniff.seeds\" cannot be | ||
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=SIMPLE]" } | ||
|
||
--- | ||
"Add transient remote cluster in sniff mode with invalid simple settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
catch: bad_request | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.simple.socket_connections: "20" | ||
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip | ||
|
||
- match: { status: 400 } | ||
- match: { error.root_cause.0.type: "illegal_argument_exception" } | ||
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.simple.socket_connections\" cannot be | ||
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SIMPLE, configured=SNIFF]" } | ||
|
||
- do: | ||
catch: bad_request | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip | ||
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip | ||
|
||
- match: { status: 400 } | ||
- match: { error.root_cause.0.type: "illegal_argument_exception" } | ||
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.simple.addresses\" cannot be | ||
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SIMPLE, configured=SNIFF]" } | ||
|
||
--- | ||
"Add transient remote cluster using simple connection mode using valid settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "simple" | ||
cluster.remote.test_remote_cluster.simple.socket_connections: "3" | ||
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip | ||
|
||
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "simple"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.socket_connections: "3"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.addresses: $remote_ip} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } | ||
|
||
--- | ||
"Add transient remote cluster using sniff connection mode using valid settings": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "sniff" | ||
cluster.remote.test_remote_cluster.sniff.node_connections: "3" | ||
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip | ||
|
||
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "sniff"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.node_connections: "3"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.seeds: $remote_ip} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } | ||
|
||
--- | ||
"Switch connection mode for configured cluster": | ||
- do: | ||
cluster.get_settings: | ||
include_defaults: true | ||
|
||
- set: { defaults.cluster.remote.my_remote_cluster.seeds.0: remote_ip } | ||
|
||
- do: | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "sniff" | ||
cluster.remote.test_remote_cluster.sniff.seeds: $remote_ip | ||
|
||
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "sniff"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.sniff\.seeds: $remote_ip} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } | ||
|
||
- do: | ||
catch: bad_request | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "simple" | ||
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip | ||
|
||
- match: { status: 400 } | ||
- match: { error.root_cause.0.type: "illegal_argument_exception" } | ||
- match: { error.root_cause.0.reason: "Setting \"cluster.remote.test_remote_cluster.sniff.seeds\" cannot be | ||
used with the configured \"cluster.remote.test_remote_cluster.mode\" [required=SNIFF, configured=SIMPLE]" } | ||
|
||
- do: | ||
cluster.put_settings: | ||
flat_settings: true | ||
body: | ||
transient: | ||
cluster.remote.test_remote_cluster.mode: "simple" | ||
cluster.remote.test_remote_cluster.sniff.seeds: null | ||
cluster.remote.test_remote_cluster.simple.addresses: $remote_ip | ||
|
||
- match: {transient.cluster\.remote\.test_remote_cluster\.mode: "simple"} | ||
- match: {transient.cluster\.remote\.test_remote_cluster\.simple\.addresses: $remote_ip} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test_remote_cluster:test_index | ||
|
||
- is_false: num_reduce_phases | ||
- match: {_clusters.total: 1} | ||
- match: {_clusters.successful: 1} | ||
- match: {_clusters.skipped: 0} | ||
- match: { _shards.total: 3 } | ||
- match: { hits.total: 6 } | ||
- match: { hits.hits.0._index: "test_remote_cluster:test_index" } |
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.