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 openai>=0.28.0
colorama>=0.4.67 colorama>=0.4.67
prometheus-swarm>=0.1.7 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", "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) response = requests.post(url, json=data)
result = response.json() result = response.json()

View File

@ -5,9 +5,9 @@ import requests
def prepare(runner, worker): def prepare(runner, worker):
"""Prepare data for worker task""" """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: 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 None
return { return {
@ -32,7 +32,7 @@ def execute(runner, worker, data):
# Handle 409 gracefully - no eligible todos is an expected case # Handle 409 gracefully - no eligible todos is an expected case
if response.status_code == 409: if response.status_code == 409:
print( 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")} return {"success": True, "message": result.get("message")}
else: else:

View File

@ -40,7 +40,7 @@ def execute(runner, worker, data):
# Handle 409 gracefully - no eligible todos is an expected case # Handle 409 gracefully - no eligible todos is an expected case
if response.status_code == 409: if response.status_code == 409:
print( 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")} return {"success": True, "message": result.get("message")}
else: else:

View File

@ -3,9 +3,9 @@ from prometheus_test.utils import create_signature
def prepare(runner, worker): 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: 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 None
payload = { payload = {
@ -38,7 +38,7 @@ def execute(runner, worker, data):
# Handle 409 gracefully - no eligible todos is an expected case # Handle 409 gracefully - no eligible todos is an expected case
if response.status_code == 409: if response.status_code == 409:
print( 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")} return {"success": True, "message": result.get("message")}
else: else:

View File

@ -6,13 +6,13 @@ from prometheus_test.utils import create_signature
def prepare(runner, worker): def prepare(runner, worker):
"""Prepare data for worker submission""" """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: 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 None
# Get submission data from worker # 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 = requests.get(url)
response.raise_for_status() response.raise_for_status()
submission_data = response.json() submission_data = response.json()
@ -44,7 +44,7 @@ def execute(runner, worker, data):
return {"success": True, "message": "Skipped due to missing PR URL"} return {"success": True, "message": "Skipped due to missing PR URL"}
# Store submission data in state # 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 result
return {"success": True, "data": data} return {"success": True, "data": data}

View File

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

View File

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