Skip to content

Commit b1c1ad2

Browse files
committed
[iris] Remove implementation-detail tests for operation polling
Tests should validate external behavior boundaries, not internal polling mechanics. Keep the service-level tests (vm_create_waits, tpu_create_waits) that verify the real contract: create succeeds even when the underlying API is async. https://claude.ai/code/session_01L4bVGg6j4fw19RiADT1GhM
1 parent 4472a81 commit b1c1ad2

1 file changed

Lines changed: 0 additions & 50 deletions

File tree

lib/iris/tests/cluster/providers/gcp/test_gcp_api.py

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -426,56 +426,6 @@ def handler(request: httpx.Request) -> httpx.Response:
426426
# ========================================================================
427427

428428

429-
def test_instance_insert_wait_polls_until_done():
430-
"""instance_insert_wait should poll the zone operation until DONE."""
431-
call_count = 0
432-
433-
def handler(request: httpx.Request) -> httpx.Response:
434-
nonlocal call_count
435-
# POST to create the instance
436-
if request.method == "POST" and "/instances" in str(request.url) and "/operations/" not in str(request.url):
437-
return _json_response(
438-
{"name": "op-123", "status": "RUNNING", "zone": f"zones/{ZONE}", "kind": "compute#operation"}
439-
)
440-
# GET to poll the operation
441-
if "/operations/op-123" in str(request.url):
442-
call_count += 1
443-
if call_count < 2:
444-
return _json_response({"name": "op-123", "status": "RUNNING"})
445-
return _json_response({"name": "op-123", "status": "DONE"})
446-
return httpx.Response(404, json={"error": {"code": 404, "message": "Not found"}})
447-
448-
api = _make_api(handler)
449-
api.instance_insert_wait(ZONE, {"name": "my-vm"})
450-
api.close()
451-
452-
assert call_count == 2, "Must poll operation until DONE"
453-
454-
455-
def test_instance_insert_wait_raises_on_operation_error():
456-
"""If the operation completes with an error, raise InfraError."""
457-
458-
def handler(request: httpx.Request) -> httpx.Response:
459-
if request.method == "POST" and "/instances" in str(request.url) and "/operations/" not in str(request.url):
460-
return _json_response(
461-
{"name": "op-err", "status": "RUNNING", "zone": f"zones/{ZONE}", "kind": "compute#operation"}
462-
)
463-
if "/operations/op-err" in str(request.url):
464-
return _json_response(
465-
{
466-
"name": "op-err",
467-
"status": "DONE",
468-
"error": {"errors": [{"code": "QUOTA_EXCEEDED", "message": "Insufficient quota"}]},
469-
}
470-
)
471-
return httpx.Response(404, json={"error": {"code": 404, "message": "Not found"}})
472-
473-
api = _make_api(handler)
474-
with pytest.raises(InfraError, match="Insufficient quota"):
475-
api.instance_insert_wait(ZONE, {"name": "my-vm"})
476-
api.close()
477-
478-
479429
def test_vm_create_waits_for_operation():
480430
"""vm_create must wait for the insert operation before describing the VM.
481431

0 commit comments

Comments
 (0)