Add more robust testing across settings

This commit is contained in:
Harrison Burt 2022-03-27 23:24:59 +01:00
parent 8acb8690fa
commit e96f8c4d98
4 changed files with 38 additions and 37 deletions

View File

@ -1,4 +1,3 @@
use anyhow::anyhow;
use bytes::Bytes;
use hashbrown::HashMap;

View File

@ -69,21 +69,21 @@ async fn test_basic_aot_upload_retrieval_without_guessing() -> anyhow::Result<()
.await;
res.assert_status(StatusCode::OK);
// let info = res.json().await;
//
// let file_id = info
// .value()
// .object()
// .get("image_id")
// .string();
//
// let res = app.get(format!("/v1/user-profiles/{}", file_id))
// .send()
// .await;
//
// res.assert_status(StatusCode::OK);
// res.assert_content_type(&"image/png".to_string());
//
let info = res.json().await;
let file_id = info
.value()
.object()
.get("image_id")
.string();
let res = app.get(format!("/v1/user-profiles/{}", file_id))
.send()
.await;
res.assert_status(StatusCode::OK);
res.assert_content_type(&"image/webp".to_string());
Ok(())
}
@ -100,20 +100,20 @@ async fn test_basic_aot_upload_retrieval_with_guessing() -> anyhow::Result<()> {
.await;
res.assert_status(StatusCode::OK);
// let info = res.json().await;
//
// let file_id = info
// .value()
// .object()
// .get("image_id")
// .string();
//
// let res = app.get(format!("/v1/user-profiles/{}", file_id))
// .send()
// .await;
//
// res.assert_status(StatusCode::OK);
// res.assert_content_type(&"image/png".to_string());
let info = res.json().await;
let file_id = info
.value()
.object()
.get("image_id")
.string();
let res = app.get(format!("/v1/user-profiles/{}", file_id))
.send()
.await;
res.assert_status(StatusCode::OK);
res.assert_content_type(&"image/webp".to_string());
Ok(())
}
@ -207,7 +207,7 @@ async fn test_basic_realtime_upload_retrieval() -> anyhow::Result<()> {
.await;
res.assert_status(StatusCode::OK);
res.assert_content_type(&"image/jpeg".to_string());
res.assert_content_type(&"image/png".to_string());
Ok(())
}
@ -238,7 +238,7 @@ async fn test_realtime_resizing() -> anyhow::Result<()> {
.await;
res.assert_status(StatusCode::OK);
res.assert_content_type(&"image/jpeg".to_string());
res.assert_content_type(&"image/png".to_string());
Ok(())
}

View File

@ -11,9 +11,9 @@ buckets:
user-profiles: # Define a bucket called "user-profiles", this is accessable out of `/images/user-profiles`.
mode: aot # Optimise images as and when they're required then store them.
formats:
png: true # Disable PNG encoding.
png: true # Enable PNG encoding.
jpeg: true # Enable JPEG encoding.
webp: false # Enable WebP encoding.
webp: true # Enable WebP encoding.
gif: false # Disable GIF encoding.
webp_config:
@ -21,7 +21,7 @@ buckets:
method: 4 # Opt on the side of performance slightly more than quality.
threading: true # Enable multi-threaded encoding.
default_serving_format: jpeg # Serve the WebP format by default.
default_serving_format: webp # Serve the WebP format by default.
default_serving_preset: medium-square # Use the "medium-square" sizing preset by default.
presets:

View File

@ -13,15 +13,17 @@ buckets:
formats:
png: true # Disable PNG encoding.
jpeg: true # Enable JPEG encoding.
webp: false # Enable WebP encoding.
webp: true # Enable WebP encoding.
gif: false # Disable GIF encoding.
original_image_store_format: jpeg
webp_config:
quality: 80 # Set lossy quality to 80%
method: 4 # Opt on the side of performance slightly more than quality.
threading: true # Enable multi-threaded encoding.
default_serving_format: jpeg # Serve the WebP format by default.
default_serving_format: png # Serve the WebP format by default.
default_serving_preset: medium-square # Use the "medium-square" sizing preset by default.
presets: