英文:
testcontainers error too many concurrent requests
问题
我正在我的测试中使用testcontainers。我想在构建容器时在Docker镜像内运行maven测试。由于构建容器中没有Docker运行时,所以无法正常工作。现在我正在尝试使用testcontainers cloud。我有一个试用帐户。以下是我的Dockerfile:
FROM maven:3.9-eclipse-temurin-19 AS build
COPY src /home/app/src
COPY pom.xml /home/app
ENV TC_CLOUD_TOKEN=<我的令牌>
RUN curl -fsSL https://app.testcontainers.cloud/bash | bash
RUN cp ~/.testcontainers.properties /root/.testcontainers.properties
RUN mvn -f /home/app/pom.xml clean package
它失败并显示错误消息“too many concurrent requests”。
以下是完整的日志:
下载 https://app.testcontainers.cloud/download/testcontainers-cloud-agent_linux_x86-64
3[0;32m下载成功!3[0m
3[0;90m版本:“Ubuntu 22.04.2 LTS/ubuntu:22.04.2 (22.04)” version=1.3.36.2210+24878683[0m
正在启动 3[0;36mtcc-agent3[0m...
2023-06-02T03:30:23.170Z --- INF Testcontainers Cloud Agent arch=amd64 os=“Ubuntu 22.04.2 LTS/ubuntu:22.04.2 (22.04)” version=1.3.36.2210+2487868
2023-06-02T03:30:23.173Z --- INF Testcontainers Cloud Agent arch=amd64 os=“Ubuntu 22.04.2 LTS/ubuntu:22.04.2 (22.04)” version=1.3.36.2210+2487868
2023-06-02T03:30:23.174Z --- INF 等待最多120秒以启动代理...
2023-06-02T03:30:24.299Z --- INF 启动监听器...
2023-06-02T03:30:24.301Z --- INF 监听地址=tcp://127.0.0.1:42289
2023-06-02T03:30:25.344Z --- INF 发现的端点数=38
2023-06-02T03:30:26.205Z --- INF 有资格的端点数=38 端点=[“zone-aws-ap-northeast-1-cluster-ap”,“zone-aws-ap-northeast-2-cluster-ap”,“zone-aws-ap-south-1-cluster-ap”,“zone-aws-ap-southeast-1-cluster-ap”,“zone-aws-ap-southeast-2-cluster-ap”,“zone-aws-ca-central-1-cluster-us”,“zone-aws-eu-central-1-cluster-eu”,“zone-aws-eu-north-1-cluster-eu”,“zone-aws-eu-west-1-cluster-eu”,“zone-aws-eu-west-2-cluster-eu”,“zone-aws-eu-west-3-cluster-eu”,“zone-aws-sa-east-1-cluster-us”,“zone-aws-us-east-1-cluster-us”,“zone-aws-us-east-2-cluster-us”,“zone-aws-us-west-1-cluster-us”,“zone-aws-us-west-2-cluster-us”,“zone-gcp-asia-east2-a-cluster-ap”,“zone-gcp-europe-central2-b-cluster-eu”,“zone-gcp-europe-north1-b-cluster-eu”,“zone-gcp-europe-southwest1-b-cluster-eu”,“zone-gcp-europe-west2-b-cluster-eu”,“zone-gcp-europe-west3-b-cluster-eu”,“zone-gcp-europe-west4-b-cluster-eu”,“zone-gcp-europe-west6-b-cluster-eu”,“zone-gcp-me-west1-a-cluster-eu”,“zone-gcp-northamerica-northeast2-a-cluster-us”,“zone-gcp-southamerica-west1-a-cluster-us”,“zone-gcp-us-central1-a-cluster-us”,“zone-gcp-us-east1-c-cluster-us”,“zone-gcp-us-east4-b-cluster-us”,“zone-gcp-us-east5-a-cluster-us”,“zone-gcp-us-east5-b-cluster-us”,“zone-gcp-us-south1-a-cluster-us”,“zone-gcp-us-west1-b-cluster-us”,“zone-gcp-us-west2-a-cluster-us”,“zone-vultr-ewr-cluster-us”,“zone-vultr-lhr-cluster-eu”,“zone-vultr-mex-cluster-us”]
2023-06-02T03:30:26.205Z --- INF 尝试查找服务器尝试=1 最大延迟=15
2023-06-02T03:30:26.222Z --- INF 尝试查找服务器尝试=2 最大延迟=15
2023-06-02T03:30:26.241Z --- INF 尝试查找服务器尝试=3 最大延迟=15
2023-06-02T03:30:26.258Z --- INF 尝试查找服务器尝试=4 最大延迟=15
2023-06-02T03:30:26.274Z --- INF 尝试查找服务器尝试=1 最大延迟=30
2023-06-02T03:30:26.306Z --- INF 尝试查找服务器尝试=2 最大延迟=30
2023-06-02T03:30:26.339Z --- INF 尝试查找服务器尝试=3 最大延迟=30
2023-06-02T03:30:26.371Z --- INF 尝试查找服务器尝试=4 最大延迟=30
2023-06-02T03:30:26.402Z --- INF 尝试查找服务器尝试=1 最大延迟=60
2023-06-02T03:30:26.463Z --- INF 尝试查找服务器尝试=2 最大延迟=60
2023-06-02T03:30:26.528Z --- INF 尝试查找服务器尝试=3 最大延迟=60
2023-06-02T03:30:26.592Z --- INF 尝试查找服务器尝试=4 最大延迟=60
2023-06-02T03:30:26.656Z --- INF 尝试查找服务器尝试=1 最大延迟=120
2023-06-02T03:30:26.778Z --- INF 尝
<details>
<summary>英文:</summary>
I'm using testcontainers in my test. I want to run maven test inside docker image when building container. It doesn't work as there is no docker runtime in the build container. Now I'm trying testcontainers cloud. I have a trial account. Here is my dockerfile
FROM maven:3.9-eclipse-temurin-19 AS build
COPY src /home/app/src
COPY pom.xml /home/app
ENV TC_CLOUD_TOKEN=<MY TOKEN>
RUN curl -fsSL https://app.testcontainers.cloud/bash | bash
RUN cp ~/.testcontainers.properties /root/.testcontainers.properties
RUN mvn -f /home/app/pom.xml clean package
It fails with error `too many concurrent requests`
here is the complete log
Downloading https://app.testcontainers.cloud/download/testcontainers-cloud-agent_linux_x86-64
\033[0;32mSUCCESSFULLY DOWNLOADED!\033[0m
\033[0;90mVersion: "Ubuntu 22.04.2 LTS/ubuntu:22.04.2 (22.04)" version=1.3.36.2210+2487868\033[0m
Launching \033[0;36mtcc-agent\033[0m...
2023-06-02T03:30:23.170Z --- INF Testcontainers Cloud Agent arch=amd64 os="Ubuntu 22.04.2 LTS/ubuntu:22.04.2 (22.04)" version=1.3.36.2210+2487868
2023-06-02T03:30:23.173Z --- INF Testcontainers Cloud Agent arch=amd64 os="Ubuntu 22.04.2 LTS/ubuntu:22.04.2 (22.04)" version=1.3.36.2210+2487868
2023-06-02T03:30:23.174Z --- INF Waiting up to 120 seconds for the agent to start...
2023-06-02T03:30:24.299Z --- INF Starting a listener...
2023-06-02T03:30:24.301Z --- INF Listening address=tcp://127.0.0.1:42289
2023-06-02T03:30:25.344Z --- INF Discovered endpoints count=38
2023-06-02T03:30:26.205Z --- INF Eligible endpoints count=38 endpoints=["zone-aws-ap-northeast-1-cluster-ap","zone-aws-ap-northeast-2-cluster-ap","zone-aws-ap-south-1-cluster-ap","zone-aws-ap-southeast-1-cluster-ap","zone-aws-ap-southeast-2-cluster-ap","zone-aws-ca-central-1-cluster-us","zone-aws-eu-central-1-cluster-eu","zone-aws-eu-north-1-cluster-eu","zone-aws-eu-west-1-cluster-eu","zone-aws-eu-west-2-cluster-eu","zone-aws-eu-west-3-cluster-eu","zone-aws-sa-east-1-cluster-us","zone-aws-us-east-1-cluster-us","zone-aws-us-east-2-cluster-us","zone-aws-us-west-1-cluster-us","zone-aws-us-west-2-cluster-us","zone-gcp-asia-east2-a-cluster-ap","zone-gcp-europe-central2-b-cluster-eu","zone-gcp-europe-north1-b-cluster-eu","zone-gcp-europe-southwest1-b-cluster-eu","zone-gcp-europe-west2-b-cluster-eu","zone-gcp-europe-west3-b-cluster-eu","zone-gcp-europe-west4-b-cluster-eu","zone-gcp-europe-west6-b-cluster-eu","zone-gcp-me-west1-a-cluster-eu","zone-gcp-northamerica-northeast2-a-cluster-us","zone-gcp-southamerica-west1-a-cluster-us","zone-gcp-us-central1-a-cluster-us","zone-gcp-us-east1-c-cluster-us","zone-gcp-us-east4-b-cluster-us","zone-gcp-us-east5-a-cluster-us","zone-gcp-us-east5-b-cluster-us","zone-gcp-us-south1-a-cluster-us","zone-gcp-us-west1-b-cluster-us","zone-gcp-us-west2-a-cluster-us","zone-vultr-ewr-cluster-us","zone-vultr-lhr-cluster-eu","zone-vultr-mex-cluster-us"]
2023-06-02T03:30:26.205Z --- INF Trying to find a server attempt=1 max_latency=15
2023-06-02T03:30:26.222Z --- INF Trying to find a server attempt=2 max_latency=15
2023-06-02T03:30:26.241Z --- INF Trying to find a server attempt=3 max_latency=15
2023-06-02T03:30:26.258Z --- INF Trying to find a server attempt=4 max_latency=15
2023-06-02T03:30:26.274Z --- INF Trying to find a server attempt=1 max_latency=30
2023-06-02T03:30:26.306Z --- INF Trying to find a server attempt=2 max_latency=30
2023-06-02T03:30:26.339Z --- INF Trying to find a server attempt=3 max_latency=30
2023-06-02T03:30:26.371Z --- INF Trying to find a server attempt=4 max_latency=30
2023-06-02T03:30:26.402Z --- INF Trying to find a server attempt=1 max_latency=60
2023-06-02T03:30:26.463Z --- INF Trying to find a server attempt=2 max_latency=60
2023-06-02T03:30:26.528Z --- INF Trying to find a server attempt=3 max_latency=60
2023-06-02T03:30:26.592Z --- INF Trying to find a server attempt=4 max_latency=60
2023-06-02T03:30:26.656Z --- INF Trying to find a server attempt=1 max_latency=120
2023-06-02T03:30:26.778Z --- INF Trying to find a server attempt=2 max_latency=120
2023-06-02T03:30:26.900Z --- INF Trying to find a server attempt=3 max_latency=120
2023-06-02T03:30:27.022Z --- INF Trying to find a server attempt=4 max_latency=120
2023-06-02T03:30:27.143Z --- INF Trying to find a server attempt=1 max_latency=240
2023-06-02T03:30:27.386Z --- INF Trying to find a server attempt=2 max_latency=240
2023-06-02T03:30:27.629Z --- INF Trying to find a server attempt=3 max_latency=240
2023-06-02T03:30:27.872Z --- INF Trying to find a server attempt=4 max_latency=240
2023-06-02T03:30:28.113Z --- INF Trying to find a server attempt=1 max_latency=480
2023-06-02T03:30:28.594Z --- INF Trying to find a server attempt=2 max_latency=480
2023-06-02T03:30:28.822Z --- INF Obtaining a worker cached= diagnosis=false endpoint=https://eks-us.workloads.testcontainers.cloud/lease?zone=vultr-ewr index=0
2023-06-02T03:30:28.823Z --- INF Picked server id=zone-vultr-ewr-cluster-us index=0 responded=227 server=66.135.28.13
2023-06-02T03:30:28.824Z --- INF Start of session client_session_id=6de00bd0-e787-4ec5-a28e-b5d026dff260
2023-06-02T03:30:30.405Z --- INF Opening direct connection endpoint=66.135.28.13:32122
2023-06-02T03:30:30.405Z --- INF Obtained a worker datacenter_id=zone-vultr-ewr-cluster-us endpoint=https://eks-us.workloads.testcontainers.cloud/lease?zone=vultr-ewr index=0 worker_id=126a6552-7e59-4829-b261-f78bfe8d5a2b
2023-06-02T03:30:30.429Z --- INF Initial connection successful connector=tunnel.direct
2023-06-02T03:30:58.637Z --- INF Unable to obtain a lease body="{"title":"Too many leases active on cluster for user","status":429}" status=429
ERROR: too many concurrent requests
2023-06-02T03:32:23.043Z --- FTL Timed out waiting for agent to be running addr=127.0.0.1:42289
Error response from daemon: The command '/bin/sh -c curl -fsSL https://app.testcontainers.cloud/bash | bash' returned a non-zero code: 1
How do I make it so that it doesn't make concurrent requests? I don't mind if it runs much slower. I want test with the trial first but it is working with a single test
</details>
# 答案1
**得分**: 2
您在这里面临[试用帐户](https://knowledge.testcontainers.cloud/how-are-trial-accounts-restricted)的限制,特别是与服务帐户相关的限制。
然而,从您分享的Dockerfile来看,尤其是在执行bash脚本时已经发生错误,不清楚并行租约是从哪里产生的。您是否碰巧同时运行了另一个构建?
您还可以访问 https://app.testcontainers.cloud 的仪表板,以确保在您运行Docker构建时没有为此服务帐户存在活动租约。
最后,欢迎加入我们的Slack(https://slack.testcontainers.org/),以获取更快的支持。
<details>
<summary>英文:</summary>
You are facing the limitation of [trial accounts](https://knowledge.testcontainers.cloud/how-are-trial-accounts-restricted) here, regarding service accounts.
However, from the Dockerfile you shared it is unclear, where the parallel leases originate, especially since the error already occurs when executing the bash script. Did you by any chance run another build at the same time?
You can also check out the dashboard at https://app.testcontainers.cloud to make sure, there is no active lease for this service account while you are running the Docker build.
Lastly, feel free to [join our Slack](https://slack.testcontainers.org/) to get faster support.
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论