test: add --block-domains integration tests#1051
Conversation
Add blockDomains option to AwfRunner test fixture and integration tests for the --block-domains deny-list feature: - Block specific subdomain while allowing parent domain - Block takes precedence over allow - Wildcard blocking patterns (*.github.com) - Multiple blocked domains - Debug output verification Closes #1041 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
Go Build Test Results
Overall: ✅ PASS
|
C++ Build Test Results
Overall: PASS 🎉 All C++ projects configured and built successfully with GCC 13.3.0.
|
|
Smoke Test Results — PASS
|
Bun Build Test Results
Overall: ✅ PASS Bun version: 1.3.9
|
.NET Build Test Results
Overall: PASS Run outputhello-world: json-parse:
|
Deno Build Test Results
Overall: ✅ PASS
|
🦀 Rust Build Test Results
Overall: ✅ PASS
|
Node.js Build Test Results ✅
Overall: PASS
|
|
Smoke Test Results (Copilot engine, run 22414057589)
Overall: PASS —
|
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive integration test coverage for the --block-domains CLI flag, which implements a deny-list on top of the existing allow-list functionality. The tests verify that blocked domains take precedence over allowed domains, support wildcard patterns, and work correctly with multiple domains.
Changes:
- Added
blockDomains?: string[]option toAwfOptionsinterface in test fixture - Implemented
--block-domainsflag handling in bothrun()andrunWithSudo()test helper methods - Added 6 integration tests covering blocking behavior, precedence rules, wildcards, and debug output
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/fixtures/awf-runner.ts | Added blockDomains option to AwfOptions interface and implemented flag handling in both run() and runWithSudo() methods |
| tests/integration/blocked-domains.test.ts | Added new test suite "Block Domains Deny-List (--block-domains)" with 6 integration tests covering subdomain blocking, precedence, wildcards, multiple domains, and debug output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| test('should handle multiple blocked domains', async () => { | ||
| const result = await runner.runWithSudo( | ||
| 'bash -c "curl -f --max-time 10 https://api.github.com/zen 2>&1; echo exit=$?"', | ||
| { | ||
| allowDomains: ['github.com'], | ||
| blockDomains: ['api.github.com', 'raw.githubusercontent.com'], | ||
| logLevel: 'debug', | ||
| timeout: 60000, | ||
| } | ||
| ); | ||
| expect(result.stdout).toContain('exit='); | ||
| expect(result.stdout).not.toContain('exit=0'); | ||
| }, 120000); |
There was a problem hiding this comment.
The test verifies that multiple blocked domains can be configured, but only tests that one domain (api.github.com) is actually blocked. Consider testing both blocked domains to ensure the configuration works correctly for all entries. For example, you could use a bash command that tries to curl both api.github.com and raw.githubusercontent.com and verifies that both fail.
There was a problem hiding this comment.
Fixed in 85e27f7. Updated the test to curl both api.github.com and raw.githubusercontent.com, and added githubusercontent.com to allowDomains so the blocklist (not the allowlist) is what causes the failures.
|
Merged PRs: docs: add integration test coverage guide with gap analysis; feat: group --help flags by category, hide dev-only options
|
Java Build Test Results
Overall: PASS ✅
|
Address Copilot review: test both api.github.com and raw.githubusercontent.com are blocked, and add githubusercontent.com to allowDomains so the blocklist (not the allowlist) is what blocks them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deno Build Test Results
Overall: ✅ PASS
|
Go Build Test Results
Overall: ✅ PASS
|
Build Test: Bun Results
Overall: ✅ PASS Tested with Bun v1.3.9.
|
.NET Build Test Results
Overall: PASS Run outputhello-world: json-parse:
|
C++ Build Test Results
Overall: PASS
|
🦀 Rust Build Test Results
Overall: ✅ PASS
|
|
Smoke Test Results — claude-sonnet-4-6
Overall: PASS
|
|
GitHub MCP (last 2 merged PRs): ✅
|
|
🤖 Smoke test results for PR #1051 ( ✅ GitHub MCP — Last 2 merged PRs: #1036 "docs: add integration test coverage guide with gap analysis", #1035 "feat: group --help flags by category, hide dev-only options" Overall: PASS
|
🟢 Node.js Build Test Results
Overall: ✅ PASS
|
☕ Java Build Test Results
Overall: ✅ PASS All Java projects compiled and passed their tests successfully via Maven with the AWF proxy.
|
Summary
blockDomains?: string[]option toAwfRunnertest fixture intests/fixtures/awf-runner.ts--block-domainsflag handling in bothrun()andrunWithSudo()methods--block-domainsdeny-list feature intests/integration/blocked-domains.test.tsTest Coverage
--allow-domains github.com --block-domains api.github.com)--block-domains *.github.com)Test plan
npm run lintpasses (0 errors)npm run buildpassesCloses #1041
🤖 Generated with Claude Code