-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (125 loc) · 5.56 KB
/
smoke.yml
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
name: Smoke tests
on: pull_request
jobs:
smoke-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
with:
cluster_name: kind # the action defaults to "chart-testing" which causes the load command below to fail
- name: Install kubectl
uses: azure/setup-kubectl@v4
- name: Install chia operator custom resources
run: |
make install
- name: Run the operator in the background
run: |
make run &
- name: Install chia components
run: |
kubectl apply -f ./tests/chiaca.yaml
kubectl apply -f ./tests/chianode.yaml
- name: Wait for ChiaCA Secret
run: |
found=0
timeout=300
endtime=$((SECONDS+timeout))
while [ ${SECONDS} -lt ${endtime} ]; do
if kubectl get secret chiaca-secret &> /dev/null; then
echo "ChiaCA Secret found"
found=1
break
else
echo "Secret not found yet. Waiting..."
sleep 5
fi
done
if [ "$found" -eq 0 ]; then
echo "Timeout reached waiting for ChiaCA Secret to be created."
echo "Getting Kubernetes Pods from the default namespace:"
kubectl get pods
echo "Getting Kubernetes Secrets from the default namespace:"
kubectl get secrets
exit 1
fi
- name: Wait for Running ChiaNode
run: |
found=0
timeout=300
endtime=$((SECONDS+timeout))
while [ $SECONDS -lt $endtime ]; do
pod_status=$(kubectl get pod chianode-test-node-0 -o jsonpath='{.status.phase}')
if [ "$pod_status" = "Running" ]; then
echo "Pod is running."
found=1
break # Exit the loop if Pod is running
elif [ "$pod_status" = "Pending" ]; then
echo "Pod is pending. Waiting..."
elif [ "$pod_status" = "Failed" ] || [ "$pod_status" = "Unknown" ]; then
echo "Pod has failed or is in an unknown state. Exiting..."
exit 1
else
echo "Pod is in state: $pod_status. Waiting..."
fi
sleep 5
done
# Check if timeout was reached or if Pod is now up
if [ "$found" -eq 0 ]; then
echo "Timeout reached waiting for ChiaNode Pod to enter Running status."
echo "Getting Kubernetes Pods from the default namespace:"
kubectl get pods
exit 1
fi
- name: Check to make sure ChiaNode peer Service has one endpoint
run: |
service_endpoints_number=$(kubectl get endpoints chianode-test-node -o json | jq '.subsets[].addresses | length')
if [ "$service_endpoints_number" -ne 1 ]; then
echo "ChiaNode peer Service was found to have $service_endpoints_number endpoints, expected 1"
exit 1
fi
echo "Expected 1 endpoint, found $service_endpoints_number"
- name: Check to make sure ChiaNode all-port Service has one endpoint
run: |
service_endpoints_number=$(kubectl get endpoints chianode-test-node-all -o json | jq '.subsets[].addresses | length')
if [ "$service_endpoints_number" -ne 1 ]; then
echo "ChiaNode all-port Service was found to have $service_endpoints_number endpoints, expected 1"
exit 1
fi
echo "Expected 1 endpoint, found $service_endpoints_number"
- name: Check to make sure ChiaNode RPC Service has one endpoint
run: |
service_endpoints_number=$(kubectl get endpoints chianode-test-node-rpc -o json | jq '.subsets[].addresses | length')
if [ "$service_endpoints_number" -ne 1 ]; then
echo "ChiaNode RPC Service was found to have $service_endpoints_number endpoints, expected 1"
exit 1
fi
echo "Expected 1 endpoint, found $service_endpoints_number"
- name: Check to make sure ChiaNode daemon Service has one endpoint
run: |
service_endpoints_number=$(kubectl get endpoints chianode-test-node-daemon -o json | jq '.subsets[].addresses | length')
if [ "$service_endpoints_number" -ne 1 ]; then
echo "ChiaNode daemon Service was found to have $service_endpoints_number endpoints, expected 1"
exit 1
fi
echo "Expected 1 endpoint, found $service_endpoints_number"
- name: Check to make sure ChiaNode headless Service has one endpoint
run: |
service_endpoints_number=$(kubectl get endpoints chianode-test-node-headless -o json | jq '.subsets[].addresses | length')
if [ "$service_endpoints_number" -ne 1 ]; then
echo "ChiaNode headless Service was found to have $service_endpoints_number endpoints, expected 1"
exit 1
fi
echo "Expected 1 endpoint, found $service_endpoints_number"
- name: Check to make sure ChiaNode internal Service has one endpoint
run: |
service_endpoints_number=$(kubectl get endpoints chianode-test-node-internal -o json | jq '.subsets[].addresses | length')
if [ "$service_endpoints_number" -ne 1 ]; then
echo "ChiaNode internal Service was found to have $service_endpoints_number endpoints, expected 1"
exit 1
fi
echo "Expected 1 endpoint, found $service_endpoints_number"