Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,24 @@ jobs:
exit 0
fi

# For PRs, check if content files changed
# For PRs, check if content or test harness files changed
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.sha }} | grep '^content/.*\.md$' || true)
CHANGED_HARNESS_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.sha }} | grep -E '^(test/|Dockerfile\.pytest$|compose\.yaml$)' || true)

if [[ -z "$CHANGED_FILES" ]]; then
# If neither content nor harness files changed, skip tests
if [[ -z "$CHANGED_FILES" && -z "$CHANGED_HARNESS_FILES" ]]; then
echo "should-run=false" >> $GITHUB_OUTPUT
echo "📝 No content changes detected - skipping code block tests"
echo "📝 No relevant changes detected - skipping code block tests"
exit 0
fi

# If only harness files changed, run influxdb3-core tests
if [[ -z "$CHANGED_FILES" && -n "$CHANGED_HARNESS_FILES" ]]; then
echo "should-run=true" >> $GITHUB_OUTPUT
PRODUCTS=("influxdb3-core")
PRODUCTS_JSON=$(printf '%s\n' "${PRODUCTS[@]}" | jq -R . | jq -s -c .)
echo "test-products=$PRODUCTS_JSON" >> $GITHUB_OUTPUT
echo "✅ Test harness changes detected - running influxdb3-core tests"
exit 0
fi

Expand Down Expand Up @@ -115,6 +127,7 @@ jobs:
mkdir -p content/influxdb/cloud
mkdir -p content/influxdb/v2
mkdir -p content/telegraf/v1
mkdir -p content/influxdb3/core

cat > content/influxdb/cloud/.env.test << 'EOF'
# Mock credentials for CI testing
Expand All @@ -138,6 +151,13 @@ jobs:
INFLUX_TOKEN=mock_token_for_ci
EOF

cat > content/influxdb3/core/.env.test << 'EOF'
# Mock credentials for CI testing
INFLUX_HOST=http://localhost:8181
INFLUX_TOKEN=mock_token_for_ci
INFLUX_DATABASE=mock_database_for_ci
EOF

echo "✅ Mock test credentials created"

- name: Run ${{ matrix.product }} code block tests
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"test:codeblocks:cloud-dedicated": "./test/scripts/monitor-tests.sh start cloud-dedicated-pytest && docker compose run --name cloud-dedicated-pytest cloud-dedicated-pytest",
"test:codeblocks:cloud-serverless": "docker compose run --rm --name cloud-serverless-pytest cloud-serverless-pytest",
"test:codeblocks:clustered": "./test/scripts/monitor-tests.sh start clustered-pytest && docker compose run --name clustered-pytest clustered-pytest",
"test:codeblocks:influxdb3-core": "docker compose run --rm --name influxdb3-core-pytest influxdb3-core-pytest",
"test:codeblocks:telegraf": "docker compose run --rm --name telegraf-pytest telegraf-pytest",
"test:codeblocks:v2": "docker compose run --rm --name v2-pytest v2-pytest",
"test:codeblocks:stop-monitors": "./test/scripts/monitor-tests.sh stop cloud-dedicated-pytest && ./test/scripts/monitor-tests.sh stop clustered-pytest",
Expand Down