mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-27 16:48:58 +00:00
refactor(app): inline bucket encryption output (#2452)
This commit is contained in:
@@ -1439,7 +1439,7 @@ impl DefaultBucketUsecase {
|
||||
if let Err(err) = site_replication_bucket_meta_hook(item).await {
|
||||
warn!(bucket = %bucket, error = ?err, "site replication bucket encryption hook failed");
|
||||
}
|
||||
Ok(S3Response::new(encryption::build_put_bucket_encryption_output()))
|
||||
Ok(S3Response::new(PutBucketEncryptionOutput::default()))
|
||||
}
|
||||
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
@@ -2841,6 +2841,21 @@ mod tests {
|
||||
assert_eq!(err.code(), &S3ErrorCode::InternalError);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn execute_put_bucket_encryption_returns_internal_error_when_store_uninitialized() {
|
||||
let input = PutBucketEncryptionInput::builder()
|
||||
.bucket("test-bucket".to_string())
|
||||
.server_side_encryption_configuration(ServerSideEncryptionConfiguration::default())
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let req = build_request(input, Method::PUT);
|
||||
let usecase = DefaultBucketUsecase::without_context();
|
||||
|
||||
let err = usecase.execute_put_bucket_encryption(req).await.unwrap_err();
|
||||
assert_eq!(err.code(), &S3ErrorCode::InternalError);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn execute_put_public_access_block_returns_internal_error_when_store_uninitialized() {
|
||||
let input = PutPublicAccessBlockInput::builder()
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use s3s::dto::{GetBucketEncryptionOutput, PutBucketEncryptionOutput, ServerSideEncryptionConfiguration};
|
||||
use s3s::dto::{GetBucketEncryptionOutput, ServerSideEncryptionConfiguration};
|
||||
|
||||
pub(crate) fn build_get_bucket_encryption_output(
|
||||
server_side_encryption_configuration: Option<ServerSideEncryptionConfiguration>,
|
||||
@@ -22,13 +22,9 @@ pub(crate) fn build_get_bucket_encryption_output(
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn build_put_bucket_encryption_output() -> PutBucketEncryptionOutput {
|
||||
PutBucketEncryptionOutput::default()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{build_get_bucket_encryption_output, build_put_bucket_encryption_output};
|
||||
use super::build_get_bucket_encryption_output;
|
||||
use s3s::dto::ServerSideEncryptionConfiguration;
|
||||
|
||||
#[test]
|
||||
@@ -38,10 +34,4 @@ mod tests {
|
||||
|
||||
assert_eq!(output.server_side_encryption_configuration, config);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_build_put_bucket_encryption_output_is_default() {
|
||||
let output = build_put_bucket_encryption_output();
|
||||
assert_eq!(output, Default::default());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user