Skip to content

Update Managed Files #182

Update Managed Files

Update Managed Files #182

Workflow file for this run

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"