Prepare isolated Qwen Image 2.1 evaluation

This commit is contained in:
Mikei386
2026-09-21 08:52:36 +02:00
parent 302b08e051
commit 1a660c20ba
8 changed files with 351 additions and 1 deletions
+32
View File
@@ -32,6 +32,11 @@ def restore_item(state="exited"):
"Labels": {controller.IMAGE_LABEL_KEY: controller.RESTORE_WORKER}}
def qwen_image_test_item(state="exited"):
return {"Id": "id-qwen-image-test", "State": state,
"Labels": {controller.IMAGE_LABEL_KEY: controller.QWEN_IMAGE_TEST_WORKER}}
def tts_item(state="running"):
return {"Id": "id-tts", "State": state,
"Labels": {controller.TTS_LABEL_KEY: controller.TTS_WORKER}}
@@ -177,6 +182,33 @@ class ProfileControllerTests(unittest.TestCase):
("POST", "/containers/id-restore/start"),
])
def test_qwen_image_test_is_allowlisted_and_exclusive(self):
profiles = {name: item(name) for name in controller.ALLOWED}
profiles["medium"] = item("medium", "running")
calls = []
def request(method, path):
calls.append((method, path))
return 204, b""
with patch.object(controller, "containers", return_value=profiles), \
patch.object(controller, "image_container", return_value=qwen_image_test_item()), \
patch.object(controller, "image_containers", return_value=[
image_item("running"), restore_item(), qwen_image_test_item()]), \
patch.object(controller, "tts_container", return_value=tts_item()), \
patch.object(controller, "docker_request", side_effect=request):
result = controller.set_image_worker(
True, controller.QWEN_IMAGE_TEST_WORKER)
self.assertEqual(result, {
"image_worker": "qwen-image-2.1-test", "state": "running"})
self.assertEqual(calls, [
("POST", "/containers/id-medium/stop?t=120"),
("POST", "/containers/id-tts/stop?t=30"),
("POST", "/containers/id-flux/stop?t=20"),
("POST", "/containers/id-qwen-image-test/start"),
])
def test_profile_activation_stops_image_worker_first(self):
profiles = {name: item(name) for name in controller.ALLOWED}
calls = []