-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-environment-validation.yaml
More file actions
180 lines (147 loc) · 5.74 KB
/
test-environment-validation.yaml
File metadata and controls
180 lines (147 loc) · 5.74 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: Test Environment Setup and Validation
on:
push:
branches:
- main
workflow_dispatch:
inputs:
test_suite:
description: 'Test suite to run (e.g., resourceindexpolicy, or empty for all)'
required: false
default: ''
type: string
pull_request: {}
env:
# Enable experimental remote taskfiles feature
TASK_X_REMOTE_TASKFILES: 1
# Test infrastructure configuration
TEST_INFRA_CLUSTER_NAME: test-infra
SEARCH_IMAGE_NAME: ghcr.io/datum-cloud/search
SEARCH_IMAGE_TAG: dev
jobs:
test-environment-validation:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
cache: true
- name: Install Task CLI
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
- name: Verify Task installation
run: |
task --version
echo "Available tasks:"
task --list
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
with:
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 4
- name: Install kubectl
uses: azure/setup-kubectl@v4
with:
version: 'v1.30.0'
- name: Install KinD
uses: helm/kind-action@v1
with:
install_only: true
version: v0.24.0
- name: Verify prerequisites
run: |
echo "=== Checking prerequisites ==="
docker version
kubectl version --client
kind version
echo "Go version: $(go version)"
- name: Set up test environment
run: |
echo "=== Setting up test environment ==="
task ci:setup
- name: Verify Search components
run: |
echo "=== Verifying Search components ==="
# Verify all Search components are running
echo "Checking Search control plane components:"
task test-infra:kubectl -- get pods -n search-system
# Wait for controller manager to be ready
echo "⏳ Waiting for controller manager to be ready..."
task test-infra:kubectl -- wait --for=condition=Ready pod -l app.kubernetes.io/name=search-controller-manager -n search-system --timeout=1000s
# Wait for API server to be ready
echo "⏳ Waiting for API server to be ready..."
task test-infra:kubectl -- wait --for=condition=Ready pod -l app.kubernetes.io/name=search-apiserver -n search-system --timeout=1000s
# Verify Aggregated API Availability (CA Injection)
echo "⏳ Verifying Aggregated API Availability..."
for i in {1..30}; do
CA_LEN=$(task test-infra:kubectl -- get apiservice v1alpha1.search.miloapis.com -o jsonpath='{len(.spec.caBundle)}' 2>/dev/null || echo "0")
if [ "$CA_LEN" -gt "0" ]; then
echo "✅ CA Bundle injected into APIService."
break
fi
echo "Waiting for CA injection into APIService..."
sleep 2
done
# Verify Discovery works
echo "Verifying API Discovery..."
task test-infra:kubectl -- get resourceindexpolicies
echo "✓ Search components verification complete"
- name: Run end-to-end tests
run: |
echo "=== Running end-to-end tests ==="
# Determine which tests to run based on input
if [ -n "${{ github.event.inputs.test_suite }}" ]; then
echo "Running specified test suite: ${{ github.event.inputs.test_suite }}"
task test:end-to-end -- ${{ github.event.inputs.test_suite }}
else
echo "Running all end-to-end tests..."
task test:end-to-end
fi
- name: Collect debug information on failure
if: failure()
run: |
echo "=== Collecting debug information ==="
# Cluster status
echo "=== Infrastructure Cluster Status ==="
task test-infra:kubectl -- get pods -A || true
task test-infra:kubectl -- get nodes -o wide || true
# Search control plane status
echo "=== Search Control Plane Status ==="
task test-infra:kubectl -- describe pods -n search-system || true
# Search API server logs
echo "=== Search API Server Logs ==="
task test-infra:kubectl -- logs -n search-system -l app.kubernetes.io/name=search-apiserver --tail=100 || true
# Controller manager logs
echo "=== Controller Manager Logs ==="
task test-infra:kubectl -- logs -n search-system -l app.kubernetes.io/name=search-controller-manager --tail=100 || true
# Docker container status
echo "=== Docker Containers ==="
docker ps -a || true
# KinD cluster info
echo "=== KinD cluster info ==="
kind get clusters || true
kind export logs /tmp/kind-logs --name $TEST_INFRA_CLUSTER_NAME || true
- name: Upload debug artifacts
if: failure()
uses: actions/upload-artifact@v7
with:
name: debug-logs
path: |
/tmp/kind-logs/
if-no-files-found: ignore
- name: Cleanup test infrastructure
if: always()
run: |
echo "=== Cleaning up test infrastructure ==="
# Clean up test infrastructure cluster
task test-infra:cluster-down || true
# Verify cleanup
echo "Remaining KinD clusters:"
kind get clusters || true
echo "Remaining Docker containers:"
docker ps -a --filter "name=test-infra" || true