Skip to content

Commit 676157b

Browse files
authored
Add errno check to FS mock S3 tests (#1424)
Simple update to the test to check error number. We check this in other parts of the code, but this provides integration testing using the mock S3 HTTP server tests. Provides some basic coverage related to #1422. ### Does this change impact existing behavior? No, test change only. ### Does this change need a changelog entry? Does it require a version change? No. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the [Developer Certificate of Origin (DCO)](https://developercertificate.org/). Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
1 parent be792de commit 676157b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mountpoint-s3-fs/tests/mock_s3_tests.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use mountpoint_s3_client::config::{
88
use mountpoint_s3_client::error_metadata::ClientErrorMetadata;
99
use mountpoint_s3_client::S3CrtClient;
1010
use mountpoint_s3_fs::fs::error_metadata::{ErrorMetadata, MOUNTPOINT_ERROR_CLIENT};
11-
use mountpoint_s3_fs::fs::FUSE_ROOT_INODE;
11+
use mountpoint_s3_fs::fs::{ToErrno, FUSE_ROOT_INODE};
1212

1313
use mountpoint_s3_fs::S3Filesystem;
1414
use test_case::test_case;
@@ -17,6 +17,7 @@ mod common;
1717

1818
#[test_case(true, false; "head object")]
1919
#[test_case(false, true; "list object")]
20+
#[test_case(true, true; "both list and head")]
2021
#[tokio::test]
2122
async fn test_lookup_throttled_mock(head_object_throttled: bool, list_object_throttled: bool) {
2223
let bucket = "bucket";
@@ -72,6 +73,13 @@ async fn test_lookup_throttled_mock(head_object_throttled: bool, list_object_thr
7273
.lookup(FUSE_ROOT_INODE, key.as_ref())
7374
.await
7475
.expect_err("lookup must fail");
76+
let actual_errno = nix::errno::Errno::from_raw(err.to_errno());
77+
let expected_errno = nix::errno::Errno::EIO;
78+
assert_eq!(
79+
actual_errno, expected_errno,
80+
"lookup failure due to HTTP 503 must return {:?}",
81+
expected_errno,
82+
);
7583
let metadata = err.meta();
7684
assert_eq!(
7785
*metadata,

0 commit comments

Comments
 (0)