@@ -70,71 +70,94 @@ check_endpoint "http://localhost:3000" "200" "UI"
7070kill $pf_pid 2> /dev/null || true
7171sleep 2
7272
73- # # Skip OTEL collector metrics test (port 8888 not exposed by HyperDX collector)
74- # echo "Skipping OTEL collector metrics test (not exposed on port 8888)"
75-
76- # # Test data ingestion
77- # echo "Testing data ingestion..."
78- # kubectl port-forward service/$RELEASE_NAME-hdx-oss-v2-otel-collector 4318:4318 -n $NAMESPACE &
79- # pf_pid=$!
80- # sleep 10
81-
82- # # Send test log
83- # echo "Sending test log..."
84- # timestamp=$(date +%s)
85- # curl -X POST http://localhost:4318/v1/logs \
86- # -H "Content-Type: application/json" \
87- # -d '{
88- # "resourceLogs": [{
89- # "resource": {
90- # "attributes": [
91- # {"key": "service.name", "value": {"stringValue": "test-service"}},
92- # {"key": "environment", "value": {"stringValue": "test"}}
93- # ]
94- # },
95- # "scopeLogs": [{
96- # "scope": {"name": "test-scope"},
97- # "logRecords": [{
98- # "timeUnixNano": "'${timestamp}'000000000",
99- # "severityText": "INFO",
100- # "body": {"stringValue": "Test log from deployment check"}
101- # }]
102- # }]
103- # }]
104- # }' > /dev/null 2>&1
105-
106- # echo "Log sent"
107-
108- # # Send test trace
109- # echo "Sending test trace..."
110- # trace_id=$(openssl rand -hex 16)
111- # span_id=$(openssl rand -hex 8)
112- # curl -X POST http://localhost:4318/v1/traces \
113- # -H "Content-Type: application/json" \
114- # -d '{
115- # "resourceSpans": [{
116- # "resource": {
117- # "attributes": [
118- # {"key": "service.name", "value": {"stringValue": "test-service"}}
119- # ]
120- # },
121- # "scopeSpans": [{
122- # "scope": {"name": "test-tracer"},
123- # "spans": [{
124- # "traceId": "'$trace_id'",
125- # "spanId": "'$span_id'",
126- # "name": "test-operation",
127- # "kind": 1,
128- # "startTimeUnixNano": "'${timestamp}'000000000",
129- # "endTimeUnixNano": "'$((timestamp + 1))'000000000"
130- # }]
131- # }]
132- # }]
133- # }' > /dev/null 2>&1
134-
135- # echo "Trace sent"
136-
137- # kill $pf_pid 2>/dev/null || true
73+ # Test OTEL collector metrics endpoint
74+ echo " Testing OTEL collector metrics endpoint..."
75+ kubectl port-forward service/$RELEASE_NAME -hdx-oss-v2-otel-collector 8888:8888 -n $NAMESPACE &
76+ metrics_pf_pid=$!
77+ sleep 10
78+
79+ wait_for_service " http://localhost:8888/metrics" " OTEL Metrics"
80+ check_endpoint " http://localhost:8888/metrics" " 200" " OTEL Metrics endpoint"
81+
82+ kill $metrics_pf_pid 2> /dev/null || true
83+ sleep 2
84+
85+ # Test data ingestion
86+ echo " Testing data ingestion..."
87+ kubectl port-forward service/$RELEASE_NAME -hdx-oss-v2-otel-collector 4318:4318 -n $NAMESPACE &
88+ pf_pid=$!
89+ sleep 10
90+
91+ # Test OTLP endpoint connectivity
92+ if ! nc -z localhost 4318; then
93+ echo " ERROR: OTEL HTTP endpoint not accessible"
94+ exit 1
95+ fi
96+
97+ # Send test log
98+ echo " Sending test log..."
99+ timestamp=$( date +%s)
100+ log_response=$( curl -X POST http://localhost:4318/v1/logs \
101+ -H " Content-Type: application/json" \
102+ -d ' {
103+ "resourceLogs": [{
104+ "resource": {
105+ "attributes": [
106+ {"key": "service.name", "value": {"stringValue": "test-service"}},
107+ {"key": "environment", "value": {"stringValue": "test"}}
108+ ]
109+ },
110+ "scopeLogs": [{
111+ "scope": {"name": "test-scope"},
112+ "logRecords": [{
113+ "timeUnixNano": "' ${timestamp} ' 000000000",
114+ "severityText": "INFO",
115+ "body": {"stringValue": "Test log from deployment check"}
116+ }]
117+ }]
118+ }]
119+ }' -w " %{http_code}" -s -o /dev/null)
120+
121+ if [ " $log_response " = " 200" ] || [ " $log_response " = " 202" ]; then
122+ echo " Log sent successfully (status: $log_response )"
123+ else
124+ echo " WARNING: Log send failed with status: $log_response "
125+ fi
126+
127+ # Send test trace
128+ echo " Sending test trace..."
129+ trace_id=$( openssl rand -hex 16)
130+ span_id=$( openssl rand -hex 8)
131+ trace_response=$( curl -X POST http://localhost:4318/v1/traces \
132+ -H " Content-Type: application/json" \
133+ -d ' {
134+ "resourceSpans": [{
135+ "resource": {
136+ "attributes": [
137+ {"key": "service.name", "value": {"stringValue": "test-service"}}
138+ ]
139+ },
140+ "scopeSpans": [{
141+ "scope": {"name": "test-tracer"},
142+ "spans": [{
143+ "traceId": "' $trace_id ' ",
144+ "spanId": "' $span_id ' ",
145+ "name": "test-operation",
146+ "kind": 1,
147+ "startTimeUnixNano": "' ${timestamp} ' 000000000",
148+ "endTimeUnixNano": "' $(( timestamp + 1 )) ' 000000000"
149+ }]
150+ }]
151+ }]
152+ }' -w " %{http_code}" -s -o /dev/null)
153+
154+ if [ " $trace_response " = " 200" ] || [ " $trace_response " = " 202" ]; then
155+ echo " Trace sent successfully (status: $trace_response )"
156+ else
157+ echo " WARNING: Trace send failed with status: $trace_response "
158+ fi
159+
160+ kill $pf_pid 2> /dev/null || true
138161
139162# Test databases
140163echo " Testing ClickHouse..."
@@ -153,24 +176,27 @@ else
153176 exit 1
154177fi
155178
156- # # Check if data got ingested
157- # echo "Waiting for data ingestion..."
158- # sleep 30
179+ # Check if data got ingested
180+ echo " Waiting for data ingestion..."
181+ sleep 30
159182
160- # echo "Checking ingested data..."
161- # log_count=$(kubectl exec -n $NAMESPACE deployment/$RELEASE_NAME-hdx-oss-v2-clickhouse -- clickhouse-client --query "SELECT count() FROM default.otel_logs WHERE ServiceName = 'test-service'" 2>/dev/null || echo "0")
183+ echo " Checking ingested data..."
184+ log_count=$( kubectl exec -n $NAMESPACE deployment/$RELEASE_NAME -hdx-oss-v2-clickhouse -- clickhouse-client --query " SELECT count() FROM default.otel_logs WHERE ServiceName = 'test-service'" 2> /dev/null || echo " 0" )
185+ trace_count=$( kubectl exec -n $NAMESPACE deployment/$RELEASE_NAME -hdx-oss-v2-clickhouse -- clickhouse-client --query " SELECT count() FROM default.otel_traces WHERE ServiceName = 'test-service'" 2> /dev/null || echo " 0" )
162186
163- # echo "Found $log_count test log records"
187+ echo " Found $log_count test log records"
188+ echo " Found $trace_count test trace records"
164189
165- # if [ "$log_count" -gt "0" ]; then
166- # echo "Data ingestion: OK"
167- # else
168- # echo "Data ingestion: No data found (may be normal for quick test)"
169- # fi
190+ if [ " $log_count " -gt " 0 " ] || [ " $trace_count " -gt " 0" ]; then
191+ echo " Data ingestion: OK"
192+ else
193+ echo " Data ingestion: No data found (may be normal for quick test or data processing delay )"
194+ fi
170195
171196echo " "
172197echo " Tests completed successfully"
173198echo " - All components running"
174199echo " - Endpoints responding"
175- # echo "- Data ingestion working"
200+ echo " - OTEL collector metrics accessible"
201+ echo " - Data ingestion tested"
176202echo " - Database connections OK"
0 commit comments