@@ -1494,6 +1494,33 @@ def test_build_layer_with_makefile_no_compatible_runtimes(self):
1494
1494
"random" ,
1495
1495
)
1496
1496
1497
+ @parameterized .expand (
1498
+ [("makefile" , False ), ("makefile" , "use_container" ), ("python3.9" , False ), ("python3.9" , "use_container" )]
1499
+ )
1500
+ def test_build_layer_with_architecture_not_compatible (self , build_method , use_container ):
1501
+ # The BuildArchitecture is not one of the listed CompatibleArchitectures
1502
+
1503
+ layer_identifier = "LayerWithNoCompatibleArchitectures"
1504
+
1505
+ overrides = {
1506
+ "LayerBuildMethod" : build_method ,
1507
+ "LayerMakeContentUri" : "PyLayerMake" ,
1508
+ "LayerBuildArchitecture" : "x86_64" ,
1509
+ "LayerCompatibleArchitecture" : "arm64" ,
1510
+ }
1511
+ cmdlist = self .get_command_list (
1512
+ use_container = use_container , parameter_overrides = overrides , function_identifier = layer_identifier
1513
+ )
1514
+
1515
+ command_result = run_command (cmdlist , cwd = self .working_dir )
1516
+ # Capture warning
1517
+ self .assertIn (
1518
+ f"Layer `{ layer_identifier } ` has BuildArchitecture `x86_64`, which is not listed in CompatibleArchitectures." ,
1519
+ str (command_result .stderr ),
1520
+ )
1521
+ # Build should still succeed
1522
+ self .assertEqual (command_result .process .returncode , 0 )
1523
+
1497
1524
@parameterized .expand ([("python3.7" , False , "LayerTwo" ), ("python3.7" , "use_container" , "LayerTwo" )])
1498
1525
def test_build_fails_with_missing_metadata (self , runtime , use_container , layer_identifier ):
1499
1526
if use_container and (SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD ):
@@ -1508,6 +1535,19 @@ def test_build_fails_with_missing_metadata(self, runtime, use_container, layer_i
1508
1535
self .assertEqual (command_result .process .returncode , 1 )
1509
1536
self .assertFalse (self .default_build_dir .joinpath (layer_identifier ).exists ())
1510
1537
1538
+ @parameterized .expand ([("python3.7" , False , "LayerOne" ), ("python3.7" , "use_container" , "LayerOne" )])
1539
+ def test_build_with_missing_buildarchitecture (self , runtime , use_container , layer_identifier ):
1540
+ if use_container and (SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD ):
1541
+ self .skipTest (SKIP_DOCKER_MESSAGE )
1542
+
1543
+ overrides = {"LayerBuildMethod" : runtime , "LayerContentUri" : "PyLayer" }
1544
+ cmdlist = self .get_command_list (
1545
+ use_container = use_container , parameter_overrides = overrides , function_identifier = layer_identifier
1546
+ )
1547
+ command_result = run_command (cmdlist , cwd = self .working_dir )
1548
+ self .assertEqual (command_result .process .returncode , 0 )
1549
+ self .assertIn ("No BuildArchitecture specifed" , str (command_result .stderr ))
1550
+
1511
1551
@parameterized .expand ([("python3.7" , False ), ("python3.7" , "use_container" )])
1512
1552
def test_build_function_and_layer (self , runtime , use_container ):
1513
1553
if use_container and (SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD ):
0 commit comments