Skip to content

Add e2e and int tests for guard diagnostics#360

Merged
satyakigh merged 5 commits intomainfrom
testing/diagnostics/e2e
Apr 27, 2026
Merged

Add e2e and int tests for guard diagnostics#360
satyakigh merged 5 commits intomainfrom
testing/diagnostics/e2e

Conversation

@kddejong
Copy link
Copy Markdown
Collaborator

@kddejong kddejong commented Dec 11, 2025

Description of changes:

Add e2e and integration tests for Guard diagnostics, covering the full diagnostic lifecycle through the LSP protocol.

E2E tests (tst/e2e/Diagnostics.test.ts) — real LSP client/server over JSON-RPC:

  • Receive guard diagnostics when opening a template with violations
  • Receive guard diagnostics when incrementally typing a new resource
  • Detect public access configuration violations with message content assertion
  • Diagnostics are cleared when a document is closed

Integration tests (tst/integration/diagnostics/Guard.test.ts) — TemplateBuilder with real GuardService:

  • S3 bucket versioning violations detected, then resolved by adding configuration (YAML)
  • S3 public access violations with severity and message assertions (YAML)
  • IAM overly-permissive policy detection (YAML)
  • S3 public access violations in JSON format

Test utilities:

  • DiagnosticExpectationBuilder for declarative diagnostic assertions (source, message pattern, severity, count)
  • TestExtension gains receivedDiagnostics tracking and mockWorkspaceConfig for settings
  • Custom guard rules file (test-guard-rules.guard) for deterministic e2e testing

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kddejong kddejong requested a review from a team as a code owner December 11, 2025 16:16
@kddejong kddejong force-pushed the testing/diagnostics/e2e branch 3 times, most recently from 9a0e051 to 3b9a3c5 Compare December 12, 2025 02:03
Comment thread tst/e2e/Diagnostics.test.ts Outdated
Comment thread tst/e2e/Diagnostics.test.ts Outdated
Comment thread tst/e2e/Diagnostics.test.ts Outdated
@kddejong kddejong force-pushed the testing/diagnostics/e2e branch from 682e6d4 to 4c30933 Compare December 15, 2025 17:31
atennak1
atennak1 previously approved these changes Mar 2, 2026
gemammercado
gemammercado previously approved these changes Mar 3, 2026
@kddejong kddejong dismissed stale reviews from gemammercado and atennak1 via 8a07ce1 April 22, 2026 18:57
@kddejong kddejong force-pushed the testing/diagnostics/e2e branch from e917dbb to 8a07ce1 Compare April 22, 2026 18:57
@satyakigh satyakigh force-pushed the testing/diagnostics/e2e branch from 8a07ce1 to ca8a16a Compare April 27, 2026 17:56
@satyakigh satyakigh merged commit b73e9fb into main Apr 27, 2026
14 of 15 checks passed
@satyakigh satyakigh deleted the testing/diagnostics/e2e branch April 27, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants