moto/tests/test_ecs/test_ecs_efs.py
2023-01-29 22:47:50 -01:00

44 lines
1.2 KiB
Python

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"]
task["volumes"].should.equal(
[
{
"name": "vol1",
"efsVolumeConfiguration": {
"fileSystemId": "sth",
"rootDirectory": "/",
"transitEncryption": "ENABLED",
},
}
]
)