Skip to content

Commit 994d200

Browse files
committed
Adding script to inspect kurtosis endpoints.
1 parent 69969d6 commit 994d200

File tree

4 files changed

+136
-16
lines changed

4 files changed

+136
-16
lines changed

.github/consensus_synced.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
endpoints:
2+
- name: "local"
3+
executionUrl: http://127.0.0.1:32773
4+
consensusUrl: http://127.0.0.1:32786
5+
6+
tests:
7+
- name: "basic"
8+
timeout: 48h
9+
tasks:
10+
- name: check_clients_are_healthy
11+
title: "Consensus client is healthy"
12+
config:
13+
skipExecutionCheck: true
14+
15+
- name: check_consensus_sync_status
16+
title: consensus is synced

.github/geth.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import http from 'k6/http';
2+
import { check, sleep } from 'k6';
3+
4+
// Define the execution and consensus URLs
5+
const executionUrl = 'http://127.0.0.1:32773'; // Replace with your actual execution URL
6+
const consensusUrl = 'http://127.0.0.1:32786'; // Replace with your actual consensus URL
7+
8+
export default function () {
9+
// Test the execution endpoint
10+
let execRes = http.get(`${executionUrl}/health`); // Adjust the endpoint as needed
11+
check(execRes, {
12+
'Execution service is up': (r) => r.status === 200,
13+
});
14+
15+
// Test the consensus endpoint
16+
let consRes = http.get(`${consensusUrl}/health`); // Adjust the endpoint as needed
17+
check(consRes, {
18+
'Consensus service is up': (r) => r.status === 200,
19+
});
20+
21+
// Optional: Add more specific checks based on your application's API responses
22+
if (execRes.status === 200) {
23+
check(execRes, {
24+
'Execution response contains expected data': (r) => r.json().status === 'synced', // Example check
25+
});
26+
}
27+
28+
if (consRes.status === 200) {
29+
check(consRes, {
30+
'Consensus response contains expected data': (r) => r.json().status === 'synced', // Example check
31+
});
32+
}
33+
34+
sleep(1); // Pause for a second between iterations
35+
}

.github/scripts/inspect_cluster.sh

+57-15
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,69 @@
11
#!/bin/bash
22

3-
# Inspect the Kurtosis enclave
3+
# Inspect the Kurtosis enclave and capture the output
44
output=$(kurtosis enclave inspect my-testnet)
55

6-
# Extract relevant information
7-
services=$(echo "$output" | awk '/User Services/,/Search results:/ {if(NR>4) print $0}')
6+
# Check if the command succeeded
7+
if [[ $? -ne 0 ]]; then
8+
echo "Error: Failed to inspect the enclave 'my-testnet'."
9+
exit 1
10+
fi
811

9-
# Prepare an array to hold service details
10-
declare -a service_details
12+
# Prepare an array to hold endpoint configurations
13+
declare -a endpoints
1114

12-
# Loop through each service entry
15+
# Extract the "User Services" section from the output
16+
services_section=$(echo "$output" | awk '/User Services:/,0' | sed '1d')
17+
18+
# Debugging: Output the services section for inspection
19+
echo "Services section extracted:"
20+
echo "$services_section"
21+
22+
# Loop through each line in the services section
1323
while IFS= read -r line; do
14-
# Skip empty lines
15-
[[ -z "$line" ]] && continue
24+
# Skip empty or invalid lines
25+
[[ -z "$line" || "$line" =~ ^Search\ results: ]] && continue
1626

17-
# Extract UUID, Name, and Ports
27+
# Debugging: Output each line being processed
28+
echo "Processing line: $line"
29+
30+
# Extract UUID, Name, and Ports using awk
1831
uuid=$(echo "$line" | awk '{print $1}')
1932
name=$(echo "$line" | awk '{print $2}')
20-
ports=$(echo "$line" | awk '{for(i=3;i<=NF;i++) printf $i " "; print ""}' | sed 's/ *$//') # Join all remaining fields as ports
33+
ports=$(echo "$line" | awk '{for(i=3;i<=NF;i++) printf $i " "; print ""}' | sed 's/ *$//')
34+
35+
# Debugging: Output the extracted UUID, Name, and Ports
36+
echo "UUID: $uuid"
37+
echo "Name: $name"
38+
echo "Ports: $ports"
39+
40+
# Check if the service is related to an execution client (e.g., Geth, Lodestar, Prysm)
41+
if [[ "$name" == *"geth"* || "$name" == *"lodestar"* || "$name" == *"prysm"* ]]; then
42+
# Extract RPC and Metrics ports using regex
43+
rpc_port=$(echo "$ports" | grep -oP 'rpc: \K[0-9]+' | head -1)
44+
metrics_port=$(echo "$ports" | grep -oP 'metrics: \K[0-9]+' | head -1)
45+
46+
# Debugging: Output the extracted RPC and Metrics ports
47+
echo "RPC Port: $rpc_port"
48+
echo "Metrics Port: $metrics_port"
49+
50+
# Check if both RPC and Metrics ports are found
51+
if [[ -n "$rpc_port" && -n "$metrics_port" ]]; then
52+
# Construct the endpoint JSON object and add it to the array
53+
endpoints+=("{\"name\": \"$name\", \"executionUrl\": \"http://localhost:$rpc_port\", \"consensusUrl\": \"http://localhost:$metrics_port\"}")
54+
fi
55+
fi
56+
done <<< "$services_section"
57+
58+
# Print the array in a usable format
59+
echo "Endpoints array:"
60+
for endpoint in "${endpoints[@]}"; do
61+
echo "$endpoint"
62+
done
2163

22-
# Format the output for Assertor
23-
service_details+=("{\"uuid\": \"$uuid\", \"name\": \"$name\", \"ports\": \"$ports\"}")
24-
done <<< "$services"
64+
# If you want to return the array to be used later in the script:
65+
# You can access the array like this:
66+
# for endpoint in "${endpoints[@]}"; do
67+
# echo "$endpoint"
68+
# done
2569

26-
# Print the extracted service details in JSON format for Assertor
27-
echo "[${service_details[*]}]"

.github/workflows/on_release_consensus_tests.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,31 @@ jobs:
3131
- name: Load Network Params and Run Ethereum Package
3232
run: |
3333
# Create a local network_params.yaml file from the repository or use an existing one
34-
curl --location --request POST '127.0.0.1:63588' --header 'Content-Type: application/json' --data-raw '{"jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 83}'
34+
kurtosis enclave inspect my-testnet
35+
36+
- name: Download and build assertoor
37+
run: |
38+
# Run assertoor in pipeline
39+
git clone https://github.com/ethpandaops/assertoor.git && cd assertoor && make build
40+
41+
- name: List all files in repo
42+
run: |
43+
# Run assertoor in pipeline
44+
ls -a
45+
46+
# - name: Run basic eth syncing test
47+
# run: |
48+
# # Run assertoor in pipeline
49+
# ./bin/assertoor --config=https://raw.githubusercontent.com/axol-io/assert-in-prod/refs/heads/Add_Nethermind_All_Consenus_clients_tests/.github/consensus_synced.yaml
50+
51+
- name: Checkout
52+
uses: actions/checkout@v2
53+
54+
- name: Setup K6
55+
uses: grafana/setup-k6-action@v1
56+
57+
- name: Run local k6 test
58+
uses: grafana/run-k6-action@v1
59+
with:
60+
path: https://raw.githubusercontent.com/axol-io/assert-in-prod/refs/heads/Add_Nethermind_All_Consenus_clients_tests/.github/geth.js
61+
flags: --vus 50 --duration 30s # Adjust VUs and duration as needed

0 commit comments

Comments
 (0)