Skip to content

Commit f795d02

Browse files
authored
test(fetchers): add live integration tests behind feature flag (#84)
Adds `live-tests` feature flag with tests hitting real endpoints for all 13 fetchers. Tests assert structural properties (non-empty, expected substrings) rather than exact content. Network errors gracefully skip instead of failing. CI job detects changed fetcher files via `scripts/changed-fetcher-tests.sh` and runs only the relevant live tests (continue-on-error: true, non-blocking).
1 parent e764737 commit f795d02

File tree

4 files changed

+448
-0
lines changed

4 files changed

+448
-0
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,37 @@ jobs:
112112
python examples/python_fetchkit.py
113113
timeout-minutes: 2
114114

115+
live-tests:
116+
name: Live Fetcher Tests
117+
if: github.event_name == 'pull_request'
118+
runs-on: ubuntu-latest
119+
steps:
120+
- uses: actions/checkout@v6
121+
with:
122+
fetch-depth: 0
123+
- uses: dtolnay/rust-toolchain@stable
124+
- uses: Swatinem/rust-cache@v2
125+
- name: Detect changed fetchers
126+
id: detect
127+
run: |
128+
FILTERS=$(bash scripts/changed-fetcher-tests.sh "origin/${{ github.base_ref }}")
129+
echo "filters=$FILTERS" >> "$GITHUB_OUTPUT"
130+
if [ -z "$FILTERS" ]; then
131+
echo "skip=true" >> "$GITHUB_OUTPUT"
132+
else
133+
echo "skip=false" >> "$GITHUB_OUTPUT"
134+
fi
135+
- name: Run live tests
136+
if: steps.detect.outputs.skip == 'false'
137+
run: |
138+
for filter in ${{ steps.detect.outputs.filters }}; do
139+
echo "::group::Running $filter"
140+
cargo test --features live-tests -p fetchkit "$filter" -- --nocapture
141+
echo "::endgroup::"
142+
done
143+
timeout-minutes: 5
144+
continue-on-error: true
145+
115146
# Gate job for branch protection.
116147
check:
117148
name: Check

crates/fetchkit/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ readme = "../../README.md"
1313
[features]
1414
default = []
1515
bot-auth = ["dep:ed25519-dalek", "dep:base64", "dep:sha2", "dep:rand"]
16+
live-tests = []
1617

1718
[dependencies]
1819
tokio = { workspace = true }

0 commit comments

Comments
 (0)