@@ -398,6 +398,10 @@ def test_build_args(self, basic_standard_image_target):
398398 def test_build_args_cache_registry (self , basic_standard_image_target ):
399399 """Test the build property of an ImageTarget."""
400400 basic_standard_image_target .settings = ImageTargetSettings (cache_registry = "ghcr.io/posit-dev" )
401+ # Cache name includes platform suffix
402+ platforms = basic_standard_image_target .image_os .platforms
403+ platform_suffix = "-" .join (p .removeprefix ("linux/" ).replace ("/" , "-" ) for p in platforms )
404+ cache_name_with_platform = f"{ basic_standard_image_target .cache_name } -{ platform_suffix } "
401405 expected_build_args = {
402406 "context_path" : basic_standard_image_target .context .base_path ,
403407 "file" : basic_standard_image_target .containerfile ,
@@ -407,10 +411,10 @@ def test_build_args_cache_registry(self, basic_standard_image_target):
407411 "push" : False ,
408412 "output" : {},
409413 "cache" : True ,
410- "cache_from" : f"type=registry,ref={ basic_standard_image_target . cache_name } " ,
411- "cache_to" : f"type=registry,ref={ basic_standard_image_target . cache_name } ,mode=max" ,
414+ "cache_from" : f"type=registry,ref={ cache_name_with_platform } " ,
415+ "cache_to" : f"type=registry,ref={ cache_name_with_platform } ,mode=max" ,
412416 "metadata_file" : None ,
413- "platforms" : [ "linux/amd64" ] ,
417+ "platforms" : platforms ,
414418 }
415419
416420 with patch ("python_on_whales.docker.build" ) as mock_build :
0 commit comments