1010 types : [opened, synchronize, reopened]
1111 workflow_dispatch :
1212 inputs :
13- test_suite :
14- description : ' Test suite to run (all, cloud, v2, telegraf, or specific products )'
13+ products :
14+ description : ' Products to test (comma-separated: core,enterprise, telegraf,v2,cloud,cloud-dedicated,cloud-serverless,clustered )'
1515 required : false
16- default : ' all'
16+ default : ' '
17+ use_default_group :
18+ description : ' Use default group (core + telegraf) if no products specified'
19+ type : boolean
20+ required : false
21+ default : true
22+
23+ # Product to test script mapping
24+ # Products that run automatically in CI (on PR):
25+ # - core (influxdb3_core) → influxdb3-core-pytest
26+ # - telegraf → telegraf-pytest
27+ # - v2 → v2-pytest
28+ # Products available for manual dispatch only:
29+ # - cloud → cloud-pytest
30+ # - cloud-dedicated → cloud-dedicated-pytest
31+ # - cloud-serverless → cloud-serverless-pytest
32+ # - clustered → clustered-pytest
33+ # Products without pytest services (content paths only):
34+ # - enterprise → content/influxdb3/enterprise
35+ # - v1 → content/influxdb/v1
36+ # - explorer → content/influxdb3/explorer
1737
1838jobs :
1939 detect-changes :
@@ -32,10 +52,72 @@ jobs:
3252 - name : Check if tests should run
3353 id : check
3454 run : |
35- # For workflow_dispatch, always run tests
55+ # Default product group: core + telegraf
56+ DEFAULT_PRODUCTS=("influxdb3_core" "telegraf")
57+
58+ # For workflow_dispatch, use specified products or default
3659 if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
3760 echo "should-run=true" >> $GITHUB_OUTPUT
38- echo "test-products=[\"cloud\", \"v2\", \"telegraf\"]" >> $GITHUB_OUTPUT
61+
62+ INPUT_PRODUCTS="${{ github.event.inputs.products }}"
63+ USE_DEFAULT="${{ github.event.inputs.use_default_group }}"
64+
65+ if [[ -n "$INPUT_PRODUCTS" ]]; then
66+ # Parse comma-separated products and normalize names
67+ PRODUCTS=()
68+ IFS=',' read -ra PRODUCT_LIST <<< "$INPUT_PRODUCTS"
69+ for product in "${PRODUCT_LIST[@]}"; do
70+ # Trim whitespace and normalize product names
71+ product=$(echo "$product" | xargs)
72+ case "$product" in
73+ core|influxdb3_core|influxdb3-core)
74+ PRODUCTS+=("influxdb3_core")
75+ ;;
76+ enterprise|influxdb3_enterprise|influxdb3-enterprise)
77+ PRODUCTS+=("influxdb3_enterprise")
78+ ;;
79+ telegraf)
80+ PRODUCTS+=("telegraf")
81+ ;;
82+ v2|influxdb_v2)
83+ PRODUCTS+=("v2")
84+ ;;
85+ v1|influxdb_v1)
86+ PRODUCTS+=("v1")
87+ ;;
88+ cloud|influxdb_cloud)
89+ PRODUCTS+=("cloud")
90+ ;;
91+ cloud-dedicated|cloud_dedicated)
92+ PRODUCTS+=("cloud-dedicated")
93+ ;;
94+ cloud-serverless|cloud_serverless)
95+ PRODUCTS+=("cloud-serverless")
96+ ;;
97+ clustered)
98+ PRODUCTS+=("clustered")
99+ ;;
100+ explorer|influxdb3_explorer)
101+ PRODUCTS+=("explorer")
102+ ;;
103+ *)
104+ echo "⚠️ Unknown product: $product (skipping)"
105+ ;;
106+ esac
107+ done
108+ elif [[ "$USE_DEFAULT" == "true" ]]; then
109+ PRODUCTS=("${DEFAULT_PRODUCTS[@]}")
110+ echo "📦 Using default product group: ${PRODUCTS[*]}"
111+ else
112+ echo "❌ No products specified and default group disabled"
113+ echo "should-run=false" >> $GITHUB_OUTPUT
114+ exit 0
115+ fi
116+
117+ # Convert to JSON array
118+ PRODUCTS_JSON=$(printf '%s\n' "${PRODUCTS[@]}" | jq -R . | jq -s -c .)
119+ echo "test-products=$PRODUCTS_JSON" >> $GITHUB_OUTPUT
120+ echo "✅ Will run tests for: ${PRODUCTS[*]}"
39121 exit 0
40122 fi
41123
@@ -51,23 +133,65 @@ jobs:
51133 echo "should-run=true" >> $GITHUB_OUTPUT
52134
53135 # Determine which product tests to run based on changed files
136+ # Note: cloud, cloud-dedicated, cloud-serverless, and clustered are excluded
137+ # from automatic CI runs. Use manual workflow_dispatch to test these products.
54138 PRODUCTS=()
55139
56- if echo "$CHANGED_FILES" | grep -q '^content/influxdb/cloud/'; then
57- PRODUCTS+=("cloud")
140+ # InfluxDB 3 products (automatic CI)
141+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb3/core/'; then
142+ PRODUCTS+=("influxdb3_core")
143+ fi
144+
145+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb3/enterprise/'; then
146+ PRODUCTS+=("influxdb3_enterprise")
58147 fi
59148
149+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb3/explorer/'; then
150+ PRODUCTS+=("explorer")
151+ fi
152+
153+ # InfluxDB v1/v2 products (automatic CI - v2 only)
60154 if echo "$CHANGED_FILES" | grep -q '^content/influxdb/v2/'; then
61155 PRODUCTS+=("v2")
62156 fi
63157
158+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb/v1/'; then
159+ PRODUCTS+=("v1")
160+ fi
161+
162+ # Telegraf (automatic CI)
64163 if echo "$CHANGED_FILES" | grep -q '^content/telegraf/'; then
65164 PRODUCTS+=("telegraf")
66165 fi
67166
68- # If no specific products matched or shared content changed, run all
69- if [[ ${#PRODUCTS[@]} -eq 0 ]] || echo "$CHANGED_FILES" | grep -q '^content/shared/'; then
70- PRODUCTS=("cloud" "v2" "telegraf")
167+ # Log excluded products if their content changed (for visibility)
168+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb3/cloud-dedicated/'; then
169+ echo "ℹ️ cloud-dedicated content changed - excluded from automatic CI (use manual dispatch)"
170+ fi
171+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb3/cloud-serverless/'; then
172+ echo "ℹ️ cloud-serverless content changed - excluded from automatic CI (use manual dispatch)"
173+ fi
174+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb3/clustered/'; then
175+ echo "ℹ️ clustered content changed - excluded from automatic CI (use manual dispatch)"
176+ fi
177+ if echo "$CHANGED_FILES" | grep -q '^content/influxdb/cloud/'; then
178+ echo "ℹ️ cloud content changed - excluded from automatic CI (use manual dispatch)"
179+ fi
180+
181+ # If shared content changed, use default group (core + telegraf)
182+ if echo "$CHANGED_FILES" | grep -q '^content/shared/'; then
183+ echo "📁 Shared content changed - adding default products"
184+ for default_product in "${DEFAULT_PRODUCTS[@]}"; do
185+ if [[ ! " ${PRODUCTS[*]} " =~ " ${default_product} " ]]; then
186+ PRODUCTS+=("$default_product")
187+ fi
188+ done
189+ fi
190+
191+ # If no specific products matched, use default group
192+ if [[ ${#PRODUCTS[@]} -eq 0 ]]; then
193+ echo "📦 No specific products detected - using default group"
194+ PRODUCTS=("${DEFAULT_PRODUCTS[@]}")
71195 fi
72196
73197 # Convert to JSON array
@@ -112,10 +236,51 @@ jobs:
112236 run : |
113237 # Create mock .env.test files for CI
114238 # In production, these would be configured with actual credentials
239+
240+ # InfluxDB 3 products
241+ mkdir -p content/influxdb3/core
242+ mkdir -p content/influxdb3/enterprise
243+ mkdir -p content/influxdb3/cloud-dedicated
244+ mkdir -p content/influxdb3/cloud-serverless
245+ mkdir -p content/influxdb3/clustered
246+
247+ # InfluxDB v1/v2 products
115248 mkdir -p content/influxdb/cloud
116249 mkdir -p content/influxdb/v2
250+ mkdir -p content/influxdb/v1
251+
252+ # Telegraf
117253 mkdir -p content/telegraf/v1
118254
255+ # InfluxDB 3 Core
256+ cat > content/influxdb3/core/.env.test << 'EOF'
257+ # Mock credentials for CI testing
258+ INFLUX_HOST=http://localhost:8282
259+ INFLUX_TOKEN=mock_token_for_ci
260+ INFLUX_DATABASE=test_db
261+ EOF
262+
263+ # InfluxDB 3 Enterprise
264+ cat > content/influxdb3/enterprise/.env.test << 'EOF'
265+ # Mock credentials for CI testing
266+ INFLUX_HOST=http://localhost:8181
267+ INFLUX_TOKEN=mock_token_for_ci
268+ INFLUX_DATABASE=test_db
269+ EOF
270+
271+ # InfluxDB 3 Cloud products
272+ for product in cloud-dedicated cloud-serverless clustered; do
273+ cat > content/influxdb3/$product/.env.test << 'EOF'
274+ # Mock credentials for CI testing
275+ INFLUX_HOST=https://cluster.influxdata.com
276+ INFLUX_TOKEN=mock_token_for_ci
277+ INFLUX_DATABASE=test_db
278+ ACCOUNT_ID=mock_account
279+ CLUSTER_ID=mock_cluster
280+ EOF
281+ done
282+
283+ # InfluxDB Cloud (v2)
119284 cat > content/influxdb/cloud/.env.test << 'EOF'
120285 # Mock credentials for CI testing
121286 INFLUX_HOST=https://cloud2.influxdata.com
@@ -124,6 +289,7 @@ jobs:
124289 INFLUX_BUCKET=mock_bucket
125290 EOF
126291
292+ # InfluxDB v2
127293 cat > content/influxdb/v2/.env.test << 'EOF'
128294 # Mock credentials for CI testing
129295 INFLUX_HOST=http://localhost:8086
@@ -132,6 +298,15 @@ jobs:
132298 INFLUX_BUCKET=mock_bucket
133299 EOF
134300
301+ # InfluxDB v1
302+ cat > content/influxdb/v1/.env.test << 'EOF'
303+ # Mock credentials for CI testing
304+ INFLUX_HOST=http://localhost:8086
305+ INFLUX_USERNAME=mock_user
306+ INFLUX_PASSWORD=mock_password
307+ EOF
308+
309+ # Telegraf
135310 cat > content/telegraf/v1/.env.test << 'EOF'
136311 # Mock credentials for CI testing
137312 INFLUX_HOST=https://cloud2.influxdata.com
@@ -146,8 +321,58 @@ jobs:
146321 run : |
147322 echo "Running tests for ${{ matrix.product }}..."
148323
149- # Run the specific product test suite
150- yarn test:codeblocks:${{ matrix.product }} || EXIT_CODE=$?
324+ # Map product names to yarn test commands
325+ # Some products don't have pytest services yet - skip them gracefully
326+ case "${{ matrix.product }}" in
327+ influxdb3_core)
328+ TEST_CMD="yarn test:codeblocks:influxdb3_core"
329+ ;;
330+ influxdb3_enterprise)
331+ echo "⚠️ InfluxDB 3 Enterprise tests not yet configured - skipping"
332+ echo "test-status=skipped" >> $GITHUB_OUTPUT
333+ echo "exit-code=0" >> $GITHUB_OUTPUT
334+ exit 0
335+ ;;
336+ telegraf)
337+ TEST_CMD="yarn test:codeblocks:telegraf"
338+ ;;
339+ v2)
340+ TEST_CMD="yarn test:codeblocks:v2"
341+ ;;
342+ v1)
343+ echo "⚠️ InfluxDB v1 tests not yet configured - skipping"
344+ echo "test-status=skipped" >> $GITHUB_OUTPUT
345+ echo "exit-code=0" >> $GITHUB_OUTPUT
346+ exit 0
347+ ;;
348+ cloud)
349+ TEST_CMD="yarn test:codeblocks:cloud"
350+ ;;
351+ cloud-dedicated)
352+ TEST_CMD="yarn test:codeblocks:cloud-dedicated"
353+ ;;
354+ cloud-serverless)
355+ TEST_CMD="yarn test:codeblocks:cloud-serverless"
356+ ;;
357+ clustered)
358+ TEST_CMD="yarn test:codeblocks:clustered"
359+ ;;
360+ explorer)
361+ echo "⚠️ InfluxDB 3 Explorer tests not yet configured - skipping"
362+ echo "test-status=skipped" >> $GITHUB_OUTPUT
363+ echo "exit-code=0" >> $GITHUB_OUTPUT
364+ exit 0
365+ ;;
366+ *)
367+ echo "❌ Unknown product: ${{ matrix.product }}"
368+ echo "test-status=failed" >> $GITHUB_OUTPUT
369+ echo "exit-code=1" >> $GITHUB_OUTPUT
370+ exit 1
371+ ;;
372+ esac
373+
374+ # Run the test command
375+ $TEST_CMD || EXIT_CODE=$?
151376
152377 # Capture exit code for reporting
153378 if [[ -n "$EXIT_CODE" ]]; then
@@ -161,24 +386,42 @@ jobs:
161386 - name : Generate test summary
162387 if : always()
163388 run : |
164- cat >> $GITHUB_STEP_SUMMARY << 'EOF'
389+ STATUS="${{ steps.test.outputs.test-status }}"
390+ case "$STATUS" in
391+ passed)
392+ STATUS_ICON="✅ Passed"
393+ ;;
394+ skipped)
395+ STATUS_ICON="⏭️ Skipped"
396+ ;;
397+ *)
398+ STATUS_ICON="❌ Failed"
399+ ;;
400+ esac
401+
402+ cat >> $GITHUB_STEP_SUMMARY << EOF
165403 ## Code Block Test Results - ${{ matrix.product }}
166404
167- **Status:** ${{ steps.test.outputs.test-status == 'passed' && '✅ Passed' || '❌ Failed' }}
405+ **Status:** $STATUS_ICON
168406 **Product:** ${{ matrix.product }}
169407 **Exit Code:** ${{ steps.test.outputs.exit-code }}
170408
171409 EOF
172410
173- if [[ "${{ steps.test.outputs.test-status }} " == "failed" ]]; then
411+ if [[ "$STATUS " == "failed" ]]; then
174412 cat >> $GITHUB_STEP_SUMMARY << 'EOF'
175413 ⚠️ **Note:** Code block tests require valid credentials configured in `.env.test` files.
176414 In CI, mock credentials are used which may cause some tests to fail.
177415 Review the test output above for specific failures.
178416
179417 To test locally with real credentials:
180418 1. Create `.env.test` files in product directories
181- 2. Run `yarn test:codeblocks:${{ matrix.product }}`
419+ 2. Run `yarn test:codeblocks:<product>`
420+ EOF
421+ elif [[ "$STATUS" == "skipped" ]]; then
422+ cat >> $GITHUB_STEP_SUMMARY << 'EOF'
423+ ℹ️ **Note:** This product does not have a pytest service configured yet.
424+ To add testing support, create a Docker Compose service in `compose.yaml`.
182425 EOF
183426 fi
184427
@@ -199,6 +442,11 @@ jobs:
199442 echo "::error::Code block tests failed for ${{ matrix.product }}"
200443 exit 1
201444
445+ - name : Report skipped tests
446+ if : steps.test.outputs.test-status == 'skipped'
447+ run : |
448+ echo "::notice::Tests skipped for ${{ matrix.product }} - pytest service not configured"
449+
202450 test-summary :
203451 name : Code Block Test Summary
204452 needs : [detect-changes, test-codeblocks]
0 commit comments