forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add null and empty string validation to S3 bucket (elastic#107883)
Add basic validation to S3 bucket name - nullity and empty string. It is aligned with public [docs](https://www.elastic.co/guide/en/elasticsearch/reference/8.13/repository-s3.html#repository-s3-repository) for "bucket" as required field. We might want to add more validations based on S3 naming rules. This PR should not be a breaking change because missing bucket will eventually throw exception later in the code with obscure error. I've added yaml test to modules [repository_s3/10_basic.yml](https://github.com/elastic/elasticsearch/compare/main...mhl-b:elasticsearch:s3-bucket-validation?expand=1#diff-08cf26742fe939f5575961254c4d3b4bff6915141cdd6abe4cd28a743d1b70ba), not sure if it's a right place. Addresses elastic#107840
- Loading branch information
Showing
4 changed files
with
71 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
50 changes: 40 additions & 10 deletions
50
...es/repository-s3/src/yamlRestTest/resources/rest-api-spec/test/repository_s3/10_basic.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 |
---|---|---|
@@ -1,16 +1,46 @@ | ||
# Integration tests for repository-s3 | ||
# | ||
"Module repository-s3 is loaded": | ||
- skip: | ||
reason: "contains is a newly added assertion" | ||
features: contains | ||
- do: | ||
cluster.state: {} | ||
- skip: | ||
reason: "contains is a newly added assertion" | ||
features: contains | ||
- do: | ||
cluster.state: { } | ||
|
||
# Get master node id | ||
- set: { master_node: master } | ||
# Get master node id | ||
- set: { master_node: master } | ||
|
||
- do: | ||
nodes.info: {} | ||
- do: | ||
nodes.info: { } | ||
|
||
- contains: { nodes.$master.modules: { name: repository-s3 } } | ||
- contains: { nodes.$master.modules: { name: repository-s3 } } | ||
|
||
--- | ||
"Create S3 snapshot repository": | ||
- do: | ||
snapshot.create_repository: | ||
repository: test-snapshot-repo | ||
verify: false | ||
body: | ||
type: s3 | ||
settings: | ||
bucket: test-bucket | ||
|
||
--- | ||
"Create S3 snapshot repository without bucket": | ||
- do: | ||
catch: /illegal_argument_exception/ | ||
snapshot.create_repository: | ||
repository: test-snapshot-repo-without-bucket | ||
verify: false | ||
body: | ||
type: s3 | ||
- do: | ||
catch: /illegal_argument_exception/ | ||
snapshot.create_repository: | ||
repository: test-snapshot-repo-without-bucket | ||
verify: false | ||
body: | ||
type: s3 | ||
settings: | ||
bucket: "" |