def test_it_returns_a_map(self): subject = AWSFargateTask(task_arn="testTaskArn", cpu_limit=100, memory_limit_in_mb=200) assert subject.serialize_to_map() == { "computeType": "aws_fargate_task", "taskArn": "testTaskArn", "cpuLimit": 100, "memoryLimitInMB": 200 }
def test_it_returns_host_name_and_host_type(self): subject = AWSFargateTask.look_up_metadata( url=DUMMY_URI_FOR_TEST) assert subject.task_arn == "testTaskARN" assert subject.cpu_limit == 123 assert subject.memory_limit_in_mb == 789 assert subject.get_fleet_instance_id() == "testTaskARN"
def test_it_returns_none_when_call_fails(self): """ With httpretty, we have disabled all network connection; hence the call to get the fargate metadata should always fail. """ subject = AWSFargateTask.look_up_metadata( url=DUMMY_URI_FOR_TEST) assert subject is None
def test_it_returns_none(self): subject = AWSFargateTask.look_up_metadata( url=DUMMY_URI_FOR_TEST) assert subject is None
def test_it_returns_none_when_url_is_none(self): subject = AWSFargateTask.look_up_metadata(url=None) assert subject is None
def test_it_returns_the_compute_platform(self): subject = AWSFargateTask(task_arn="testTaskArn", cpu_limit=100, memory_limit_in_mb=200) assert subject.get_metadata_for_configure_agent_call() == None