| 
									
										
										
										
											2023-01-29 22:47:50 -01:00
										 |  |  | import boto3 | 
					
						
							|  |  |  | from moto import mock_ecs, mock_efs | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @mock_ecs | 
					
						
							|  |  |  | @mock_efs | 
					
						
							|  |  |  | def test_register_task_definition__use_efs_root(): | 
					
						
							|  |  |  |     client = boto3.client("ecs", region_name="us-east-1") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     container_definition = { | 
					
						
							|  |  |  |         "name": "hello_world", | 
					
						
							|  |  |  |         "image": "docker/hello-world:latest", | 
					
						
							|  |  |  |         "cpu": 1024, | 
					
						
							|  |  |  |         "memory": 400, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     task_definition = client.register_task_definition( | 
					
						
							|  |  |  |         family="test_ecs_task", | 
					
						
							|  |  |  |         containerDefinitions=[container_definition], | 
					
						
							|  |  |  |         volumes=[ | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 "name": "vol1", | 
					
						
							|  |  |  |                 "efsVolumeConfiguration": { | 
					
						
							|  |  |  |                     "fileSystemId": "sth", | 
					
						
							|  |  |  |                     "transitEncryption": "ENABLED", | 
					
						
							|  |  |  |                 }, | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     family = task_definition["taskDefinition"]["family"] | 
					
						
							|  |  |  |     task = client.describe_task_definition(taskDefinition=family)["taskDefinition"] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-18 15:33:16 +00:00
										 |  |  |     assert task["volumes"] == [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             "name": "vol1", | 
					
						
							|  |  |  |             "efsVolumeConfiguration": { | 
					
						
							|  |  |  |                 "fileSystemId": "sth", | 
					
						
							|  |  |  |                 "rootDirectory": "/", | 
					
						
							|  |  |  |                 "transitEncryption": "ENABLED", | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     ] |