build: pin and verify image inputs
This commit is contained in:
@@ -107,7 +107,12 @@ class TestEnsureBuilt(unittest.TestCase):
|
||||
|
||||
def test_local_mode_builds_orchestrator_before_its_fc_image(self):
|
||||
with patch.dict(os.environ, {"BOT_BOTTLE_INFRA_BUILD": "local"}), \
|
||||
patch.object(infra_vm.docker_mod, "build_image") as build:
|
||||
patch.object(infra_vm.docker_mod, "build_image") as build, \
|
||||
patch.object(
|
||||
infra_vm.docker_mod,
|
||||
"image_id",
|
||||
return_value="sha256:" + "a" * 64,
|
||||
) as image_id:
|
||||
infra_vm.ensure_built()
|
||||
tags = [c.args[0] for c in build.call_args_list]
|
||||
# orchestrator-fc is FROM orchestrator, so the base is built first.
|
||||
@@ -116,6 +121,11 @@ class TestEnsureBuilt(unittest.TestCase):
|
||||
self.assertEqual(infra_vm._ORCHESTRATOR_FC_IMAGE, tags[-1])
|
||||
self.assertLess(tags.index(infra_vm._ORCHESTRATOR_IMAGE),
|
||||
tags.index(infra_vm._ORCHESTRATOR_FC_IMAGE))
|
||||
image_id.assert_called_once_with(infra_vm._ORCHESTRATOR_IMAGE)
|
||||
self.assertEqual(
|
||||
{"ORCHESTRATOR_BASE_IMAGE": "sha256:" + "a" * 64},
|
||||
build.call_args_list[-1].kwargs["build_args"],
|
||||
)
|
||||
|
||||
|
||||
class TestStop(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user