-
Notifications
You must be signed in to change notification settings - Fork 15
165 lines (151 loc) · 5.6 KB
/
sentry-smoke-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Sentry Smoke Test
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sentry-smoke-test:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Build xatu image
run: |
docker build -t ethpandaops/xatu:local .
echo "Xatu image is built."
- name: Create Kurtosis config file
run: |
cat <<EOF > /tmp/network_params.yaml
participants:
- el_type: geth
cl_type: teku
- el_type: nethermind
cl_type: prysm
- el_type: erigon
cl_type: lighthouse
- el_type: besu
cl_type: lighthouse
- el_type: reth
cl_type: lodestar
- el_type: ethereumjs
cl_type: nimbus
additional_services: []
network_params:
genesis_delay: 180
xatu_sentry_enabled: true
xatu_sentry_params:
xatu_server_addr: xatu-server:8080
xatu_sentry_image: ethpandaops/xatu:local
beacon_subscriptions:
- attestation
- block
- chain_reorg
- finalized_checkpoint
- head
- voluntary_exit
- contribution_and_proof
<<EOF
- name: Run Xatu stack
timeout-minutes: 10
shell: bash
run: |
docker compose up --detach --quiet-pull &
- name: Setup kurtosis testnet and run assertoor tests
id: kurtosis-setup
uses: ethpandaops/kurtosis-assertoor-github-action@v1
with:
ethereum_package_args: /tmp/network_params.yaml
await_assertoor_tests: false
enclave_name: xatu
- name: Show all kurtosis containers
env:
SERVICES: ${{ steps.kurtosis-setup.outputs.services }}
run: |
echo $SERVICES
- name: Add all xatu-sentry containers to the xatu network
run: |
for container in $(docker ps --filter name=xatu-sentry --format "{{.Names}}"); do docker network connect xatu_xatu-net $container; echo $container; docker restart $container; done
- name: Verify Clickhouse has data from all sentries
timeout-minutes: 10
run: |
echo "Checking Clickhouse for data from all sentries"
all_sentries=($(kurtosis enclave inspect xatu | grep cl- | grep http | awk '{ print $2 }' | grep -v validator | sed 's/^cl-//'))
tables=(
"beacon_api_eth_v1_events_attestation"
"beacon_api_eth_v1_events_block"
"beacon_api_eth_v1_events_head"
)
# Define a function that prints the last 5 logs from all docker containers that have the argument in the name
pretty_print() {
local message=$1
local color=$2
local no_color='\033[0m'
local green='\033[0;32m'
local red='\033[0;31m'
local bright_red='\033[1;31m'
# Choose color based on the type of message
if [ "$color" == "green" ]; then
color=$green
elif [ "$color" == "red" ]; then
color=$red
elif [ "$color" == "bright_red" ]; then
color=$bright_red
else
color=$no_color
fi
echo -e "${color}######################${no_color}"
echo -e "${color} $message ${no_color}"
echo -e "${color}######################${no_color}"
}
print_logs() {
for container in $(docker ps --filter name=$1 --format "{{.Names}}"); do
echo "Logs for $container:\n\n"
docker logs --tail 5 $container
done
}
# Check for any data in the tables before digging in to the individual sentries
for table in "${tables[@]}"; do
pretty_print "Checking $table table..." "none"
data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --query "SELECT COUNT(*) FROM default.$table" || true)
if [[ $data_count -gt 0 ]]; then
pretty_print "$table table has $data_count entries" "green"
else
pretty_print "$table table has no entries." "bright_red"
print_logs xatu-server
print_logs vector
fi
done
for table in "${tables[@]}"; do
pretty_print "Checking $table table..." "none"
for sentry in "${all_sentries[@]}"; do
pretty_print "Checking $table table for $sentry..." "none"
while true; do
data_count=$(docker exec xatu-clickhouse-01 clickhouse-client --user=default --query "SELECT COUNT(*) FROM default.$table WHERE meta_client_name = '$sentry'" || true)
if [[ $data_count -gt 0 ]]; then
pretty_print "$table has $data_count entries from $sentry" "green"
break
else
pretty_print "$table has no entries from $sentry." "bright_red"
print_logs $sentry
sleep 5
fi
done
done
done
- name: Collect docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
with:
dest: './logs'
- name: Tar logs
if: failure()
run: tar cvzf ./logs.tgz ./logs
- name: Upload logs to GitHub
if: failure()
uses: actions/upload-artifact@master
with:
name: logs.tgz
path: ./logs.tgz