fix tests

This commit is contained in:
Ruben Fiszel
2023-08-13 17:20:29 +02:00
parent baaaaa14f1
commit f140d10f08
2 changed files with 18 additions and 6 deletions
+11 -3
View File
@@ -924,11 +924,19 @@ fn spawn_test_worker(
tokio::sync::broadcast::Sender<()>,
tokio::task::JoinHandle<()>,
) {
for x in [windmill_worker::LOCK_CACHE_DIR] {
std::fs::DirBuilder::new()
.recursive(true)
.create(x)
.expect("could not create initial worker dir");
}
let (tx, rx) = tokio::sync::broadcast::channel(1);
let db = db.to_owned();
let worker_instance: &str = "test worker instance";
let worker_name: String = next_worker_name();
let ip: &str = Default::default();
let future = async move {
let base_internal_url = format!("http://localhost:{}", port);
windmill_worker::run_worker::<rsmq_async::MultiplexedRsmq>(
@@ -2519,15 +2527,15 @@ async fn test_flow_lock_all(db: Pool<Postgres>) {
let listen_first_job = str.next();
in_test_worker(&db, listen_first_job, port).await;
client
let modules = client
.get_flow_by_path("test-workspace", "g/all/flow_lock_all")
.await
.unwrap()
.into_inner()
.subtype_0
.value
.modules
.into_iter()
.modules;
modules.into_iter()
.for_each(|m| {
assert!(matches!(
m.value,
+7 -3
View File
@@ -2169,10 +2169,10 @@ async fn capture_dependency_job(
match job_language {
ScriptLang::Python3 => {
create_dependencies_dir(job_dir).await;
let req = pip_compile(job_id, job_raw_code, logs, job_dir, db, worker_name, w_id).await;
let req: std::result::Result<String, Error> = pip_compile(job_id, job_raw_code, logs, job_dir, db, worker_name, w_id).await;
// install the dependencies to pre-fill the cache
if let Ok(req) = req.as_ref() {
handle_python_reqs(
let r = handle_python_reqs(
req
.split("\n")
.filter(|x| !x.starts_with("--"))
@@ -2185,7 +2185,11 @@ async fn capture_dependency_job(
job_dir,
worker_dir,
)
.await?;
.await;
if let Err(e) = r {
tracing::error!("Failed to install python dependencies to prefill the cache: {:?} \n{}", e, logs);
}
}
req
}