feat: run smolmachines sidecar as vm
This commit is contained in:
@@ -432,12 +432,7 @@ class TestBundleLaunchSpec(unittest.TestCase):
|
||||
|
||||
def test_canary_env_visible_to_smolvm_guest(self):
|
||||
plan = _plan(canary=True)
|
||||
with patch.object(
|
||||
_launch._bundle,
|
||||
"bundle_host_port",
|
||||
return_value="65000",
|
||||
):
|
||||
stamped = _launch._discover_urls(plan, "127.0.0.16")
|
||||
stamped = _launch._discover_urls(plan, "127.0.0.16", {9099: 65000})
|
||||
|
||||
self.assertEqual(
|
||||
"fake-canary-value",
|
||||
@@ -507,21 +502,11 @@ class TestProvisionGitUser(unittest.TestCase):
|
||||
|
||||
|
||||
class TestProxyHost(unittest.TestCase):
|
||||
"""_proxy_host returns the bridge gateway on Linux and the loopback
|
||||
alias on other platforms."""
|
||||
"""_proxy_host returns the per-bottle address used by the forwarder."""
|
||||
|
||||
def test_linux_returns_bundle_gateway(self):
|
||||
def test_returns_loopback_alias(self):
|
||||
plan = _plan()
|
||||
with patch("bot_bottle.backend.smolmachines.launch.platform.system",
|
||||
return_value="Linux"):
|
||||
result = _launch._proxy_host(plan, "127.0.0.16")
|
||||
self.assertEqual(plan.bundle_gateway, result)
|
||||
|
||||
def test_non_linux_returns_loopback(self):
|
||||
plan = _plan()
|
||||
with patch("bot_bottle.backend.smolmachines.launch.platform.system",
|
||||
return_value="Darwin"):
|
||||
result = _launch._proxy_host(plan, "127.0.0.16")
|
||||
result = _launch._proxy_host(plan, "127.0.0.16")
|
||||
self.assertEqual("127.0.0.16", result)
|
||||
|
||||
|
||||
@@ -544,14 +529,20 @@ class TestDiscoverUrls(unittest.TestCase):
|
||||
),),
|
||||
),
|
||||
)
|
||||
with patch.object(_launch._bundle, "bundle_host_port", return_value="9420"):
|
||||
stamped = _launch._discover_urls(plan, "127.0.0.16")
|
||||
self.assertEqual("127.0.0.16:9420", stamped.agent_git_gate_host)
|
||||
stamped = _launch._discover_urls(
|
||||
plan,
|
||||
"127.0.0.16",
|
||||
{9099: 65000, 9420: 65001},
|
||||
)
|
||||
self.assertEqual("127.0.0.16:65001", stamped.agent_git_gate_host)
|
||||
|
||||
def test_supervise_url_set_when_supervise_present(self):
|
||||
plan = _plan(supervise=True)
|
||||
with patch.object(_launch._bundle, "bundle_host_port", return_value="55556"):
|
||||
stamped = _launch._discover_urls(plan, "127.0.0.16")
|
||||
stamped = _launch._discover_urls(
|
||||
plan,
|
||||
"127.0.0.16",
|
||||
{9099: 65000, 9100: 55556},
|
||||
)
|
||||
self.assertEqual("http://127.0.0.16:55556/", stamped.agent_supervise_url)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user