Files
windmill/backend/tests/worker_group_pause.rs
T
95c4b3096c feat: pause a worker group without stopping its workers (#11596)
* feat: pause a worker group without stopping its workers

* chore: bump ee ref

* fix: keep dedicated workers running across a pause toggle

* fix: edit a copy of the worker group config in the drawer

* fix: stable priority tag order, keep pause-only configs in the drawer

* fix: keep inherited worker tags when saving from the drawer

* fix: keep an explicit empty tag list when leaving dedicated mode

* fix: keep inherited tags when creating a config from the drawer

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore: update ee-repo-ref to 6f23819e947b18878000e580ddefccfd01a73166

This commit updates the EE repository reference after PR #853 was merged in windmill-ee-private.

Previous ee-repo-ref: 6cf802bdbe17b4a66757016515044b8a9ef9ef19

New ee-repo-ref: 6f23819e947b18878000e580ddefccfd01a73166

Automated by sync-ee-ref workflow.

* feat: confirm before applying a worker config change that restarts workers

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore: pin the ee commit that compiles against main

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore: retrigger ci after the github outage dropped the push event

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
2026-10-07 17:28:29 +00:00

72 lines
2.1 KiB
Rust

//! In its own test binary: it flips the process-wide `WORKER_CONFIG`, which would stall every
//! other worker test sharing the process.
use futures::StreamExt;
use sqlx::{Pool, Postgres};
use std::time::Duration;
use windmill_common::{
jobs::{JobPayload, RawCode},
scripts::ScriptLang,
worker::{Connection, WORKER_CONFIG},
};
use windmill_test_utils::*;
fn set_paused(paused: bool) {
let mut wc = (**WORKER_CONFIG.load()).clone();
wc.paused = paused;
WORKER_CONFIG.store(std::sync::Arc::new(wc));
}
#[sqlx::test(fixtures("base"))]
async fn paused_worker_leaves_jobs_queued_until_resumed(db: Pool<Postgres>) -> anyhow::Result<()> {
initialize_tracing().await;
let server = ApiServer::start(db.clone()).await?;
let port = server.addr.port();
set_paused(true);
let id = RunJob::from(JobPayload::Code(RawCode {
hash: None,
content: "echo done".to_string(),
path: None,
lock: None,
language: ScriptLang::Bash,
cache_ttl: None,
cache_ignore_s3_path: None,
dedicated_worker: None,
concurrency_settings: windmill_common::runnable_settings::ConcurrencySettings::default()
.into(),
debouncing_settings: windmill_common::runnable_settings::DebouncingSettings::default(),
modules: None,
tag: None,
}))
.push(&db)
.await;
let mut completed = listen_for_completed_jobs(&db).await;
in_test_worker(
Connection::Sql(db.clone()),
async {
tokio::time::sleep(Duration::from_secs(3)).await;
let running =
sqlx::query_scalar::<_, bool>("SELECT running FROM v2_job_queue WHERE id = $1")
.bind(id)
.fetch_optional(&db)
.await
.unwrap();
assert_eq!(
running,
Some(false),
"a paused worker must not pull the job"
);
set_paused(false);
while completed.next().await != Some(id) {}
},
port,
)
.await;
assert!(completed_job(id, &db).await.success);
Ok(())
}