Skip to content

Commit

Permalink
Ignore system index access warning
Browse files Browse the repository at this point in the history
Signed-off-by: rithin-pullela-aws <[email protected]>
  • Loading branch information
rithin-pullela-aws committed Jan 29, 2025
1 parent 22a5faf commit 90e88ed
Show file tree
Hide file tree
Showing 9 changed files with 318 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,10 @@ protected Settings restAdminSettings() {
.build();
}

@Override
protected Settings restClientSettings() {
Settings.Builder builder = Settings.builder();
if (System.getProperty("tests.rest.client_path_prefix") != null) {
builder.put(CLIENT_PATH_PREFIX, System.getProperty("tests.rest.client_path_prefix"));
}
builder.put("strictDeprecationMode", false);
return builder.build();
}

@Override
protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOException {
boolean strictDeprecationMode = settings.getAsBoolean("strictDeprecationMode", true);
RestClientBuilder builder = RestClient.builder(hosts);
builder.setStrictDeprecationMode(false);
if (isHttps()) {
String keystore = settings.get(OPENSEARCH_SECURITY_SSL_HTTP_KEYSTORE_FILEPATH);
if (Objects.nonNull(keystore)) {
Expand All @@ -133,11 +123,13 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE
return new SecureRestClientBuilder(settings, configPath).build();
} else {
configureHttpsClient(builder, settings);
builder.setStrictDeprecationMode(strictDeprecationMode);
return builder.build();
}

} else {
configureClient(builder, settings);
builder.setStrictDeprecationMode(strictDeprecationMode);
return builder.build();
}

Expand Down
54 changes: 54 additions & 0 deletions src/test/resources/rest-api-spec/test/fstore/10_manage.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,76 @@
---
"Create and delete the default store":
- skip:
features: allowed_warnings
- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store: {}

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
indices.exists:
index: .ltrstore

- is_true: ''

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.delete_store: {}

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
indices.exists:
index: .ltrstore

- is_false: ''

---
"Create and delete a custom store":
- skip:
features: allowed_warnings
- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store:
store: mystore

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
indices.exists:
index: .ltrstore_mystore

- is_true: ''

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.get_store:
store: mystore

- match: { exists: true }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.delete_store:
store: mystore

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
indices.exists:
index: .ltrstore_mystore

- is_false: ''

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
catch: missing
ltr.get_store:
store: mystore
Expand All @@ -55,31 +79,45 @@

---
"Get cache stats":
- skip:
features: allowed_warnings
- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store: {}

- is_true: ''

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.cache_stats: {}

- match: { all.total.ram: 0 }

---
"List stores":
- skip:
features: allowed_warnings
- do:
ltr.list_stores: {}

- match: { stores: {} }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store: {}

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store:
store: mystore

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.list_stores: {}

- match: { stores._default_.version: 2 }
Expand All @@ -101,11 +139,17 @@

---
"Deleting the store should invalidate the cache":
- skip:
features: allowed_warnings
- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_custom], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store:
store: custom

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_custom], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_model:
store: custom
name: my_model
Expand Down Expand Up @@ -145,6 +189,8 @@
- gt: { all.total.ram: 0 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_custom], but in a future major version, direct access to system indices will be prevented by default"
indices.delete:
index: .ltrstore_custom

Expand All @@ -155,11 +201,17 @@

---
"Deleting the model should invalidate the cache":
- skip:
features: allowed_warnings
- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_custom], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store:
store: custom

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_custom], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_model:
store: custom
name: my_model
Expand Down Expand Up @@ -199,6 +251,8 @@
- gt: { all.total.ram: 0 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_custom], but in a future major version, direct access to system indices will be prevented by default"
ltr.delete_model:
store: custom
name: my_model
Expand Down
48 changes: 48 additions & 0 deletions src/test/resources/rest-api-spec/test/fstore/20_features.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
---
"CRUD operations test: feature on default store":
- skip:
features: allowed_warnings
- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store: {}

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_feature:
name: my_feature
body:
Expand All @@ -19,12 +25,16 @@
- match: { _version: 1 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.get_feature:
name: my_feature

- match: { _source.name: my_feature }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
catch: /version_conflict_engine_exception/
ltr.create_feature:
name: my_feature
Expand All @@ -37,6 +47,8 @@
field_test: "{{query_string2}}"

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.update_feature:
name: my_feature
body:
Expand All @@ -52,46 +64,64 @@
- match: { _version: 2 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.get_feature:
name: my_feature

- match: { _source.feature.template.match.field_test: "{{query_string2}}" }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.list_feature: {}

- match: { hits.total.value: 1 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.list_feature:
prefix: my

- match: { hits.total.value: 1 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.list_feature:
prefix: hop

- match: { hits.total.value: 0 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
ltr.delete_feature:
name: my_feature

- is_true: ''

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore], but in a future major version, direct access to system indices will be prevented by default"
catch: missing
ltr.get_feature:
name: my_feature

---
"CRUD operations test: feature on custom store":
- skip:
features: allowed_warnings
- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_store:
store: mystore

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.create_feature:
store: mystore
name: my_feature
Expand All @@ -108,13 +138,17 @@
- match: { _version: 1 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.get_feature:
store: mystore
name: my_feature

- match: { _source.name: my_feature }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
catch: /version_conflict_engine_exception/
ltr.create_feature:
store: mystore
Expand All @@ -128,6 +162,8 @@
field_test: "{{query_string2}}"

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.update_feature:
store: mystore
name: my_feature
Expand All @@ -145,40 +181,52 @@
- match: { _version: 2 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.get_feature:
store: mystore
name: my_feature

- match: { _source.feature.template.match.field_test: "{{query_string2}}" }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.list_feature:
store: mystore

- match: { hits.total.value: 1 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.list_feature:
store: mystore
prefix: my

- match: { hits.total.value: 1 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.list_feature:
store: mystore
prefix: hop

- match: { hits.total.value: 0 }

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
ltr.delete_feature:
store: mystore
name: my_feature

- is_true: ''

- do:
allowed_warnings:
- "this request accesses system indices: [.ltrstore_mystore], but in a future major version, direct access to system indices will be prevented by default"
catch: missing
ltr.get_feature:
store: mystore
Expand Down
Loading

0 comments on commit 90e88ed

Please sign in to comment.