fix e2e tests for garage v2 and uptimerobot v3 api changes
This commit is contained in:
+18
-17
@@ -138,7 +138,7 @@ def cleanup(secrets, revert_git=False):
|
||||
headers=auth,
|
||||
)
|
||||
if status == 200 and data:
|
||||
for m in data.get("monitors", []):
|
||||
for m in data.get("data", []):
|
||||
if m.get("url") == f"https://www.{TEST_DOMAIN}":
|
||||
api("DELETE", f"{UPTIMEROBOT_API}/monitors/{m['id']}", headers=auth)
|
||||
except Exception as e:
|
||||
@@ -149,10 +149,10 @@ def cleanup(secrets, revert_git=False):
|
||||
token = secrets["hantim-garage-admin-token"]
|
||||
auth = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
|
||||
status, data = api(
|
||||
"POST",
|
||||
f"{GARAGE_API}/v2/GetBucketInfo",
|
||||
"GET",
|
||||
f"{GARAGE_API}/v2/GetBucketInfo?"
|
||||
+ urllib.parse.urlencode({"globalAlias": TEST_DOMAIN}),
|
||||
headers=auth,
|
||||
data={"globalAlias": TEST_DOMAIN},
|
||||
)
|
||||
if status == 200 and data and data.get("id"):
|
||||
bid = data["id"]
|
||||
@@ -169,14 +169,8 @@ def cleanup(secrets, revert_git=False):
|
||||
"permissions": {"read": True, "write": True, "owner": False},
|
||||
},
|
||||
)
|
||||
# Remove global alias
|
||||
api(
|
||||
"POST",
|
||||
f"{GARAGE_API}/v2/RemoveBucketAlias",
|
||||
headers=auth,
|
||||
data={"bucketId": bid, "globalAlias": TEST_DOMAIN},
|
||||
)
|
||||
# Delete bucket (id is a query param, not body)
|
||||
# Delete bucket directly (Garage rejects alias removal when
|
||||
# it's the bucket's only alias, so skip RemoveBucketAlias)
|
||||
api(
|
||||
"POST",
|
||||
f"{GARAGE_API}/v2/DeleteBucket?"
|
||||
@@ -250,14 +244,21 @@ def cleanup(secrets, revert_git=False):
|
||||
except Exception as e:
|
||||
errors.append(f"Local {path}: {e}")
|
||||
|
||||
# --- Vultr DNS zone ---
|
||||
# --- Vultr DNS records (keep zone to avoid slow re-creation) ---
|
||||
try:
|
||||
key = secrets["hantim-vultr-api-key"]
|
||||
api(
|
||||
"DELETE",
|
||||
f"{VULTR_API}/domains/{TEST_DOMAIN}",
|
||||
headers={"Authorization": f"Bearer {key}"},
|
||||
auth = {"Authorization": f"Bearer {key}"}
|
||||
status, data = api(
|
||||
"GET", f"{VULTR_API}/domains/{TEST_DOMAIN}/records", headers=auth
|
||||
)
|
||||
if status == 200 and data:
|
||||
for r in data.get("records", []):
|
||||
if r["type"] == "A" and r["name"] in ("", "www"):
|
||||
api(
|
||||
"DELETE",
|
||||
f"{VULTR_API}/domains/{TEST_DOMAIN}/records/{r['id']}",
|
||||
headers=auth,
|
||||
)
|
||||
except Exception as e:
|
||||
errors.append(f"Vultr: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user