Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test github action pipeline for geth execution client. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/consensus_synced.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
endpoints:
- name: "local"
executionUrl: http://127.0.0.1:32773
consensusUrl: http://127.0.0.1:32786

tests:
- name: "basic"
timeout: 48h
tasks:
- name: check_clients_are_healthy
title: "Consensus client is healthy"
config:
skipExecutionCheck: true

- name: check_consensus_sync_status
title: consensus is synced
78 changes: 78 additions & 0 deletions .github/geth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import http from 'k6/http';
import { check, sleep } from 'k6';

// Define the execution and consensus URLs
const executionUrl = 'http://127.0.0.1:32773'; // Replace with your actual execution URL
const consensusUrl = 'http://127.0.0.1:32786'; // Replace with your actual consensus URL

// Function to send JSON-RPC requests
function sendRpcRequest(url, method, params = []) {
const payload = JSON.stringify({
jsonrpc: "2.0",
method: method,
params: params,
id: 1,
});

const res = http.post(url, payload, {
headers: { 'Content-Type': 'application/json' },
});

return res;
}

export default function () {
// Check execution node sync status
let execRes = sendRpcRequest(executionUrl, 'eth_syncing');
check(execRes, {
'Execution service is up': (r) => r.status === 200,
'Execution node is synced': (r) => r.json().result === false, // false means synced
});

// Check current block number from execution node
let blockRes = sendRpcRequest(executionUrl, 'eth_blockNumber');
check(blockRes, {
'Block number retrieved successfully': (r) => r.status === 200,
'Block number is a valid hex string': (r) => /^0x[0-9a-fA-F]+$/.test(r.json().result),
});

// Check consensus node sync status using health endpoint
let consHealthRes = http.get(`${consensusUrl}/eth/v1/node/syncing`); // Adjust according to your consensus client
check(consHealthRes, {
'Consensus service is up': (r) => r.status === 200,
'Consensus node is synced': (r) => JSON.parse(r.body).is_syncing === false, // Adjust based on actual response structure
});

// Check sync status
let syncRes = http.get(`${consensusUrl}/lighthouse/syncing`, { headers: { 'accept': 'application/json' } });
check(syncRes, {
'Syncing endpoint is up': (r) => r.status === 200,
'Node is synced': (r) => JSON.parse(r.body).SyncingFinalized === false, // Check if syncing is finalized
});

// Check connected peers
let peersRes = http.get(`${consensusUrl}/lighthouse/peers/connected`, { headers: { 'accept': 'application/json' } });
check(peersRes, {
'Peers endpoint is up': (r) => r.status === 200,
'Connected peers retrieved': (r) => Array.isArray(JSON.parse(r.body)) && JSON.parse(r.body).length > 0,
});

// Check validator metrics for a specific validator index
const validatorIndex = 12345; // Replace with the actual validator index you're interested in
let metricsRes = http.post(`${consensusUrl}/lighthouse/ui/validator_metrics`, JSON.stringify({ indices: [validatorIndex] }), {
headers: { 'Content-Type': 'application/json' },
});
check(metricsRes, {
'Validator metrics endpoint is up': (r) => r.status === 200,
'Validator metrics retrieved successfully': (r) => JSON.parse(r.body).attestation_hits !== undefined,
});

// Check health status
let healthRes = http.get(`${consensusUrl}/lighthouse/health`, { headers: { 'accept': 'application/json' } });
check(healthRes, {
'Health endpoint is up': (r) => r.status === 200,
'Health status is ok': (r) => JSON.parse(r.body).status === 'ok', // Adjust based on actual response structure
});

sleep(1); // Pause for a second between iterations
}
Loading
Loading