fix spots where tests were not updated to work with new version of test framework

This commit is contained in:
Laura Abro
2025-04-30 12:59:02 -03:00
parent 59833f5d3f
commit 7d1965c216
8 changed files with 24 additions and 20 deletions

View File

@ -17,4 +17,4 @@ sqlmodel>=0.0.22
openai>=0.28.0
colorama>=0.4.67
prometheus-swarm>=0.1.7
prometheus-test>=0.1.5
prometheus-test>=0.1.7

View File

@ -69,7 +69,7 @@ def execute(runner, worker, data):
"message": "Skipped due to missing PR URL or submission data",
}
url = f"{worker.url}/worker-audit/{runner.get('current_round')}"
url = f"{worker.get('url')}/worker-audit/{runner.get('current_round')}"
response = requests.post(url, json=data)
result = response.json()

View File

@ -5,9 +5,9 @@ import requests
def prepare(runner, worker):
"""Prepare data for worker task"""
pr_url = runner.get(f"pr_urls.{worker.name}")
pr_url = runner.get(f"pr_urls.{worker.get('name')}")
if pr_url is None:
print(f"✓ No pr_urls.{worker.name} found - continuing")
print(f"✓ No pr_urls.{worker.get('name')} found - continuing")
return None
return {
@ -32,7 +32,7 @@ def execute(runner, worker, data):
# Handle 409 gracefully - no eligible todos is an expected case
if response.status_code == 409:
print(
f"{result.get('message', 'No eligible todos')} for {worker.name} - continuing"
f"{result.get('message', 'No eligible todos')} for {worker.get('name')} - continuing"
)
return {"success": True, "message": result.get("message")}
else:

View File

@ -40,7 +40,7 @@ def execute(runner, worker, data):
# Handle 409 gracefully - no eligible todos is an expected case
if response.status_code == 409:
print(
f"{result.get('message', 'No eligible todos')} for {worker.name} - continuing"
f"{result.get('message', 'No eligible todos')} for {worker.get('name')} - continuing"
)
return {"success": True, "message": result.get("message")}
else:

View File

@ -3,9 +3,9 @@ from prometheus_test.utils import create_signature
def prepare(runner, worker):
pr_url = runner.get(f"pr_urls.{worker.name}")
pr_url = runner.get(f"pr_urls.{worker.get('name')}")
if pr_url is None:
print(f"✓ No pr_urls.{worker.name} found - continuing")
print(f"✓ No pr_urls.{worker.get('name')} found - continuing")
return None
payload = {
@ -38,7 +38,7 @@ def execute(runner, worker, data):
# Handle 409 gracefully - no eligible todos is an expected case
if response.status_code == 409:
print(
f"{result.get('message', 'No eligible todos')} for {worker.name} - continuing"
f"{result.get('message', 'No eligible todos')} for {worker.get('name')} - continuing"
)
return {"success": True, "message": result.get("message")}
else:

View File

@ -6,13 +6,13 @@ from prometheus_test.utils import create_signature
def prepare(runner, worker):
"""Prepare data for worker submission"""
pr_url = runner.get(f"pr_urls.{worker.name}")
pr_url = runner.get(f"pr_urls.{worker.get('name')}")
if pr_url is None:
print(f"✓ No pr_urls.{worker.name} found - continuing")
print(f"✓ No pr_urls.{worker.get('name')} found - continuing")
return None
# Get submission data from worker
url = f"{worker.url}/submission/{runner.get('current_round')}"
url = f"{worker.get('url')}/submission/{runner.get('current_round')}"
response = requests.get(url)
response.raise_for_status()
submission_data = response.json()
@ -44,7 +44,7 @@ def execute(runner, worker, data):
return {"success": True, "message": "Skipped due to missing PR URL"}
# Store submission data in state
runner.set(f"submission_data.{worker.name}", data, scope="round")
runner.set(f"submission_data.{worker.get('name')}", data, scope="round")
# Return success result
return {"success": True, "data": data}

View File

@ -14,7 +14,7 @@ def prepare(runner, worker):
# Generate UUID for this round
uuid = str(uuid4())
runner.set(f"uuid.{worker.name}", uuid, scope="round")
runner.set(f"uuid.{worker.get('name')}", uuid, scope="round")
# Create podcall payload and signature
podcall_payload = {
@ -22,7 +22,9 @@ def prepare(runner, worker):
"roundNumber": runner.get("current_round"),
"uuid": uuid,
}
podcall_signature = create_signature(worker.staking_signing_key, podcall_payload)
podcall_signature = create_signature(
worker.get_key("staking_signing"), podcall_payload
)
return {
"task_id": runner.get("task_id"),
@ -36,21 +38,23 @@ def execute(runner, worker, data):
"""Execute worker task step"""
if not data:
return {"success": True, "message": "No repo url found"}
url = f"{worker.url}/worker-task/{runner.get('current_round')}"
url = f"{worker.get('url')}/worker-task/{runner.get('current_round')}"
response = requests.post(url, json=data)
result = response.json()
# Handle 409 gracefully - no eligible todos is an expected case
if response.status_code == 409:
print(
f"{result.get('message', 'No eligible todos')} for {worker.name} - continuing"
f"{result.get('message', 'No eligible todos')} for {worker.get('name')} - continuing"
)
return {"success": True, "message": result.get("message")}
if result.get("success") and "pr_url" in result["result"]["data"]:
# Store PR URL in state
runner.set(
f"pr_urls.{worker.name}", result["result"]["data"]["pr_url"], scope="round"
f"pr_urls.{worker.get('name')}",
result["result"]["data"]["pr_url"],
scope="round",
)
return result

View File

@ -6,7 +6,7 @@
},
"keypairs": {
"staking": "WORKER1_STAKING_KEYPAIR",
"public": "WORKER1_PUBLIC_KEYPAIR"
"main": "WORKER1_PUBLIC_KEYPAIR"
}
},
"worker2": {
@ -16,7 +16,7 @@
},
"keypairs": {
"staking": "WORKER2_STAKING_KEYPAIR",
"public": "WORKER2_PUBLIC_KEYPAIR"
"main": "WORKER2_PUBLIC_KEYPAIR"
}
}
}