This commit is contained in:
@@ -218,3 +218,55 @@ def test_bundle_places_each_local_tool_in_its_own_tier():
|
||||
for tier, names in bundle.tools.items():
|
||||
for name in names:
|
||||
assert LOCAL_TOOLS[name][0] == tier, name
|
||||
|
||||
|
||||
def test_bundle_pins_terraform_providers_and_role_timeouts(tmp_path):
|
||||
config = minimal_bundle(
|
||||
tmp_path,
|
||||
models={"default": "gemini/m", "timeout_seconds": {"target-architect": 420}},
|
||||
terraform={
|
||||
"required_providers": {
|
||||
"cloud": {"source": "example/cloud", "version": "1.2.3"}
|
||||
}
|
||||
},
|
||||
)
|
||||
write_bundle(tmp_path, config)
|
||||
|
||||
bundle = load_provider("test", root=tmp_path)
|
||||
|
||||
assert bundle.terraform_providers == {
|
||||
"cloud": {"source": "example/cloud", "version": "1.2.3"}
|
||||
}
|
||||
assert bundle.models.timeout_for("target-architect") == 420
|
||||
assert bundle.models.timeout_for("decomposer") is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"overrides, message",
|
||||
[
|
||||
(
|
||||
{"terraform": {"required_providers": {"cloud": {"source": "x/cloud"}}}},
|
||||
"needs a 'source' and an exact 'version'",
|
||||
),
|
||||
(
|
||||
{"models": {"default": "gemini/m", "timeout_seconds": {"x": 0}}},
|
||||
"must be positive",
|
||||
),
|
||||
(
|
||||
{"models": {"default": "gemini/m", "timeout_seconds": {"x": "slow"}}},
|
||||
"must be a number",
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_bad_terraform_pins_and_timeouts_are_rejected(tmp_path, overrides, message):
|
||||
write_bundle(tmp_path, minimal_bundle(tmp_path, **overrides))
|
||||
|
||||
with pytest.raises(ProviderConfigError, match=message):
|
||||
load_provider("test", root=tmp_path)
|
||||
|
||||
|
||||
def test_gcp_bundle_pins_one_exact_google_provider_version():
|
||||
pin = load_provider("gcp").terraform_providers["google"]
|
||||
|
||||
assert pin["source"] == "hashicorp/google"
|
||||
assert pin["version"].replace(".", "").isdigit() # exact, not a range
|
||||
|
||||
Reference in New Issue
Block a user