aboutsummaryrefslogtreecommitdiff
path: root/src/garage/tests/s3
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/tests/s3')
-rw-r--r--src/garage/tests/s3/website.rs65
1 files changed, 51 insertions, 14 deletions
diff --git a/src/garage/tests/s3/website.rs b/src/garage/tests/s3/website.rs
index 4e136e1b..7579058d 100644
--- a/src/garage/tests/s3/website.rs
+++ b/src/garage/tests/s3/website.rs
@@ -56,8 +56,11 @@ async fn test_website() {
let admin_req = || {
Request::builder()
.method("GET")
- .uri(format!("http://127.0.0.1:{}/check", ctx.garage.admin_port))
- .header("domain", BCKT_NAME.to_string())
+ .uri(format!(
+ "http://127.0.0.1:{0}/check?domain={1}",
+ ctx.garage.admin_port,
+ BCKT_NAME.to_string()
+ ))
.body(Body::empty())
.unwrap()
};
@@ -91,8 +94,11 @@ async fn test_website() {
let admin_req = || {
Request::builder()
.method("GET")
- .uri(format!("http://127.0.0.1:{}/check", ctx.garage.admin_port))
- .header("domain", BCKT_NAME.to_string())
+ .uri(format!(
+ "http://127.0.0.1:{0}/check?domain={1}",
+ ctx.garage.admin_port,
+ BCKT_NAME.to_string()
+ ))
.body(Body::empty())
.unwrap()
};
@@ -120,8 +126,11 @@ async fn test_website() {
let admin_req = || {
Request::builder()
.method("GET")
- .uri(format!("http://127.0.0.1:{}/check", ctx.garage.admin_port))
- .header("domain", BCKT_NAME.to_string())
+ .uri(format!(
+ "http://127.0.0.1:{0}/check?domain={1}",
+ ctx.garage.admin_port,
+ BCKT_NAME.to_string()
+ ))
.body(Body::empty())
.unwrap()
};
@@ -408,7 +417,7 @@ async fn test_website_check_website_enabled() {
res_body,
json!({
"code": "InvalidRequest",
- "message": "Bad request: No domain header found",
+ "message": "Bad request: No domain query string found",
"region": "garage-integ-test",
"path": "/check",
})
@@ -417,8 +426,34 @@ async fn test_website_check_website_enabled() {
let admin_req = || {
Request::builder()
.method("GET")
- .uri(format!("http://127.0.0.1:{}/check", ctx.garage.admin_port))
- .header("domain", "foobar")
+ .uri(format!(
+ "http://127.0.0.1:{}/check?domain=",
+ ctx.garage.admin_port
+ ))
+ .body(Body::empty())
+ .unwrap()
+ };
+
+ let admin_resp = client.request(admin_req()).await.unwrap();
+ assert_eq!(admin_resp.status(), StatusCode::NOT_FOUND);
+ let res_body = json_body(admin_resp).await;
+ assert_json_eq!(
+ res_body,
+ json!({
+ "code": "NoSuchBucket",
+ "message": "Bucket not found: ",
+ "region": "garage-integ-test",
+ "path": "/check",
+ })
+ );
+
+ let admin_req = || {
+ Request::builder()
+ .method("GET")
+ .uri(format!(
+ "http://127.0.0.1:{}/check?domain=foobar",
+ ctx.garage.admin_port
+ ))
.body(Body::empty())
.unwrap()
};
@@ -439,20 +474,22 @@ async fn test_website_check_website_enabled() {
let admin_req = || {
Request::builder()
.method("GET")
- .uri(format!("http://127.0.0.1:{}/check", ctx.garage.admin_port))
- .header("domain", "☹")
+ .uri(format!(
+ "http://127.0.0.1:{}/check?domain=%E2%98%B9",
+ ctx.garage.admin_port
+ ))
.body(Body::empty())
.unwrap()
};
let admin_resp = client.request(admin_req()).await.unwrap();
- assert_eq!(admin_resp.status(), StatusCode::BAD_REQUEST);
+ assert_eq!(admin_resp.status(), StatusCode::NOT_FOUND);
let res_body = json_body(admin_resp).await;
assert_json_eq!(
res_body,
json!({
- "code": "InvalidRequest",
- "message": "Bad request: Invalid characters found in domain header: failed to convert header to a str",
+ "code": "NoSuchBucket",
+ "message": "Bucket not found: ☹",
"region": "garage-integ-test",
"path": "/check",
})