feat: with comparing contents
Some checks failed
continuous-integration/drone/push Build is failing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-02-18 22:37:54 +01:00
parent 02e70fe268
commit a17dd2bd10
5 changed files with 52 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ use flux_releaser::{
},
services::file_store::extensions::FileStoreExt,
};
use rand::{thread_rng, Rng};
use tokio::{net::TcpListener, runtime::Runtime, time::sleep};
use uuid::Uuid;
@@ -144,7 +145,9 @@ async fn can_upload_artifact() -> anyhow::Result<()> {
let mut client = FluxReleaserClient::connect(format!("http://{}", endpoints.grpc)).await?;
let bytes: [u8; 10000] = [0; 10000];
let mut bytes: [u8; 10000] = [0; 10000];
thread_rng().fill(&mut bytes[..]);
let chunks = bytes
.chunks(bytes.len() / 100)
@@ -157,7 +160,14 @@ async fn can_upload_artifact() -> anyhow::Result<()> {
let resp = client.upload_artifact(req).await?;
assert!(!resp.into_inner().upload_id.is_empty());
let upload_id = resp.into_inner().upload_id;
assert!(!upload_id.is_empty());
let actual_path = app.file_store().get_temp(upload_id.try_into()?).await?;
let actual_content = tokio::fs::read(actual_path).await?;
assert_eq!(&bytes[..], actual_content.as_slice());
Ok(())
}