fix(lint): remove unused imports and fix pyright type errors in reconcile
prd-number-check / require-numbered-prds (pull_request) Successful in 13s
tracker-policy-pr / check-pr (pull_request) Successful in 21s
test / image-input-builds (pull_request) Successful in 59s
lint / lint (push) Successful in 1m5s
test / integration-docker (pull_request) Successful in 1m6s
test / coverage (pull_request) Has been skipped
test / unit (pull_request) Successful in 50s
prd-number-check / require-numbered-prds (pull_request) Successful in 13s
tracker-policy-pr / check-pr (pull_request) Successful in 21s
test / image-input-builds (pull_request) Successful in 59s
lint / lint (push) Successful in 1m5s
test / integration-docker (pull_request) Successful in 1m6s
test / coverage (pull_request) Has been skipped
test / unit (pull_request) Successful in 50s
This commit is contained in:
@@ -29,7 +29,7 @@ from ...git_gate.plan import GitGatePlan
|
|||||||
from ...log import info
|
from ...log import info
|
||||||
from ...orchestrator.client import OrchestratorClient, OrchestratorClientError
|
from ...orchestrator.client import OrchestratorClient, OrchestratorClientError
|
||||||
from ...orchestrator.reprovision import reprovision_bottles
|
from ...orchestrator.reprovision import reprovision_bottles
|
||||||
from ..provision_gateway import GatewayProvisionError, provision_git_gate
|
from ..provision_gateway import provision_git_gate
|
||||||
from ..util import AGENT_CA_PATH
|
from ..util import AGENT_CA_PATH
|
||||||
from . import cleanup, util
|
from . import cleanup, util
|
||||||
from .gateway import FirecrackerGateway
|
from .gateway import FirecrackerGateway
|
||||||
@@ -72,11 +72,12 @@ def attach_bottled_agents_to_gateway(
|
|||||||
info(f"bring-up reconcile: could not list bottles, skipping: {exc}")
|
info(f"bring-up reconcile: could not list bottles, skipping: {exc}")
|
||||||
return
|
return
|
||||||
|
|
||||||
source_ip_to_bottle_id: dict[str, str] = {
|
source_ip_to_bottle_id: dict[str, str] = {}
|
||||||
b["source_ip"]: b["bottle_id"]
|
for b in bottles:
|
||||||
for b in bottles
|
source_ip = b.get("source_ip")
|
||||||
if isinstance(b.get("source_ip"), str) and isinstance(b.get("bottle_id"), str)
|
bottle_id = b.get("bottle_id")
|
||||||
}
|
if isinstance(source_ip, str) and isinstance(bottle_id, str):
|
||||||
|
source_ip_to_bottle_id[source_ip] = bottle_id
|
||||||
|
|
||||||
transport = gateway.provisioning_transport()
|
transport = gateway.provisioning_transport()
|
||||||
secrets_by_ip: dict[str, str] = {}
|
secrets_by_ip: dict[str, str] = {}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import tempfile
|
|||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import CalledProcessError, CompletedProcess
|
from subprocess import CalledProcessError, CompletedProcess
|
||||||
from unittest.mock import MagicMock, call, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
_RECONCILE = "bot_bottle.backend.firecracker.reconcile"
|
_RECONCILE = "bot_bottle.backend.firecracker.reconcile"
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ class TestPushCa(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class TestReprovisionGitGate(unittest.TestCase):
|
class TestReprovisionGitGate(unittest.TestCase):
|
||||||
def _make_state_dir(self, upstreams: list[dict]) -> Path:
|
def _make_state_dir(self, upstreams: list[dict[str, str]]) -> Path:
|
||||||
d = Path(tempfile.mkdtemp())
|
d = Path(tempfile.mkdtemp())
|
||||||
(d / "upstreams.json").write_text(json.dumps(upstreams))
|
(d / "upstreams.json").write_text(json.dumps(upstreams))
|
||||||
(d / "git_gate_pre_receive.sh").write_text("#!/bin/sh")
|
(d / "git_gate_pre_receive.sh").write_text("#!/bin/sh")
|
||||||
@@ -256,7 +256,7 @@ class TestAttachBottledAgentsToGateway(unittest.TestCase):
|
|||||||
client_cls.return_value.list_bottles.return_value = bottles
|
client_cls.return_value.list_bottles.return_value = bottles
|
||||||
attach_bottled_agents_to_gateway("http://orch:8099", gw)
|
attach_bottled_agents_to_gateway("http://orch:8099", gw)
|
||||||
reprov_gw.assert_called_once()
|
reprov_gw.assert_called_once()
|
||||||
transport_arg, bottle_id_arg, slug_arg = reprov_gw.call_args.args
|
_, bottle_id_arg, slug_arg = reprov_gw.call_args.args
|
||||||
self.assertEqual("bid-git", bottle_id_arg)
|
self.assertEqual("bid-git", bottle_id_arg)
|
||||||
self.assertEqual("agent-git11", slug_arg)
|
self.assertEqual("agent-git11", slug_arg)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user