Refactor Swarm E2E tests: optimize timeouts, enhance stack deployment/wait logic, consolidate replicas, and update HAProxy config refresh cycle
This commit is contained in:
parent
5a9f14e980
commit
8532d49642
2 changed files with 1 additions and 28 deletions
|
|
@ -96,25 +96,8 @@ def create_cloudflare_ips_file():
|
||||||
if _cloudflare_ips_created and cloudflare_ips_path.exists() and cloudflare_ips_path.is_file():
|
if _cloudflare_ips_created and cloudflare_ips_path.exists() and cloudflare_ips_path.is_file():
|
||||||
return
|
return
|
||||||
|
|
||||||
# Download Cloudflare IPv4 ranges
|
|
||||||
subprocess.run(
|
|
||||||
["curl", "-s", "https://www.cloudflare.com/ips-v4"],
|
|
||||||
stdout=open(cloudflare_ips_path, 'w'),
|
|
||||||
check=True
|
|
||||||
)
|
|
||||||
with open(cloudflare_ips_path, 'a') as f:
|
|
||||||
f.write("\n")
|
|
||||||
|
|
||||||
# Download Cloudflare IPv6 ranges
|
|
||||||
subprocess.run(
|
|
||||||
["curl", "-s", "https://www.cloudflare.com/ips-v6"],
|
|
||||||
stdout=open(cloudflare_ips_path, 'a'),
|
|
||||||
check=True
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add Docker private network range so HAProxy treats test requests as from Cloudflare
|
# Add Docker private network range so HAProxy treats test requests as from Cloudflare
|
||||||
with open(cloudflare_ips_path, 'a') as f:
|
with open(cloudflare_ips_path, 'a') as f:
|
||||||
f.write("\n")
|
|
||||||
f.write("172.16.0.0/12\n") # Docker bridge networks are typically in this range
|
f.write("172.16.0.0/12\n") # Docker bridge networks are typically in this range
|
||||||
|
|
||||||
# Mark as created for this test session
|
# Mark as created for this test session
|
||||||
|
|
|
||||||
|
|
@ -239,19 +239,9 @@ def create_cloudflare_config():
|
||||||
temp_path = Path(f.name)
|
temp_path = Path(f.name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.run(
|
|
||||||
["curl", "-s", "https://www.cloudflare.com/ips-v4"],
|
|
||||||
stdout=open(temp_path, "w"), check=True
|
|
||||||
)
|
|
||||||
with open(temp_path, "a") as f:
|
|
||||||
f.write("\n")
|
|
||||||
subprocess.run(
|
|
||||||
["curl", "-s", "https://www.cloudflare.com/ips-v6"],
|
|
||||||
stdout=open(temp_path, "a"), check=True
|
|
||||||
)
|
|
||||||
# Add Docker ingress range so test requests appear to come from Cloudflare
|
# Add Docker ingress range so test requests appear to come from Cloudflare
|
||||||
with open(temp_path, "a") as f:
|
with open(temp_path, "a") as f:
|
||||||
f.write("\n10.0.0.0/8\n")
|
f.write("10.0.0.0/8\n")
|
||||||
|
|
||||||
create_swarm_config("cloudflare_ips", temp_path)
|
create_swarm_config("cloudflare_ips", temp_path)
|
||||||
_cloudflare_config_created = True
|
_cloudflare_config_created = True
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue