Selenium Mocha对AWS ECS Docker超时测试



问题: selenuim webdriver驱动的UI测试通过NodeJS平台上执行的ui测试,并且在AWS ECS上运行速度很慢,以至于定期出来(超时= 12000000000000000000000000000000000000000000000000000000000000000000号)MS,即2分钟)。

设置:

  1. 我在AWS ECS上有一个集群。群集具有3个M4.xlarge实例,因此CPU/内存不是问题。此外,EC2实例指标表明,即使运行测试,CPU/内存利用率也是LT;1%。
  2. 用以下JSON定义了每个容器:

    { "requiresAttributes": [ { "value": null, "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18", "targetId": null, "targetType": null }, { "value": null, "name": "com.amazonaws.ecs.capability.ecr-auth", "targetId": null, "targetType": null } ], "taskDefinitionArn": "someDefinition", "networkMode": "host", "status": "ACTIVE", "revision": 23, "taskRoleArn": null, "containerDefinitions": [ { "volumesFrom": [], "memory": 400, "extraHosts": null, "linuxParameters": null, "dnsServers": null, "disableNetworking": null, "dnsSearchDomains": null, "portMappings": [ { "hostPort": 80, "containerPort": 80, "protocol": "tcp" } ], "hostname": null, "essential": true, "entryPoint": [], "mountPoints": [ { "containerPath": "/dev/shm", "sourceVolume": "hostDevShm", "readOnly": null } ], "name": "foo-automation-container", "ulimits": null, "dockerSecurityOptions": null, "environment": [], "links": null, "workingDirectory": null, "readonlyRootFilesystem": null, "image": "foo-docker-container-image", "command": [], "user": null, "dockerLabels": null, "logConfiguration": null, "cpu": 0, "privileged": null, "memoryReservation": null } ], "placementConstraints": [], "volumes": [ { "host": { "sourcePath": "/dev/shm" }, "name": "hostDevShm" } ], "family": "foo-automation-tests" }

我尝试了什么?

  1. 除了破坏和重新创建集群和任务外定义多次,我已经设置了网络模式=主机,而我已经根据此链接添加了音量安装。

  2. 我已经确保这些测试完美地运行(并且在它们的通常的速度)在本地VM上托管的容器上 - 问题仅具有AWS ECS配置。

  3. 我已经在网络上搜索了这个问题的解决方案,包括So,Docker的帮助论坛和AWS文档。

在这一点上,我撞到了墙。非常感激任何的帮助。

请让我知道是否需要任何其他信息。

好吧,我已经运行了 - 所有测试现在都以本地硬件的性能级别执行。这是我所做的:

  1. 首先,在您的任务定义中,设置网络模式=主机

在与任务关联的容器定义中:

  1. 确保删除所有端口映射 - 留在端口映射中会干扰网络模式=主机设置。
  2. 基于此链接的音量安装。
  3. 将您的CPU单位设置为> 2048(我根据0是指0表示无限CPU单元的假设)。
  4. 将您的内存设置为> = 4192。
  5. 最重要的是,在安全性下,检查"特权"。

一旦我做了这些事情,UI测试绝对完美地运行,以通常的速度(< 1秒)。

最新更新