Skip to content

test: add multi-tenant isolation property tests across plans, subscriptions, and statements (#782) - #820

Merged
thlpkee20-wq merged 2 commits into
Stellabill:mainfrom
supreme2580:test/tenant-isolation-fuzz
Aug 31, 2026
Merged

thlpkee20-wq merged 2 commits into
Stellabill:mainfrom
supreme2580:test/tenant-isolation-fuzz

Conversation

@supreme2580

Copy link
Copy Markdown
Contributor

Implements property-style integration tests for multi-tenant isolation across plans, subscriptions, and statements as requested in #782.

Changes

Test Implementation

  • New test file: internal/service/tenant_isolation_property_test.go with property-based isolation tests
  • Two-tenant fixture seeding: Tenants tenant-alpha and tenant-beta with overlapping subscription IDs (sub-a-, sub-b-) and statement IDs (stmt-a-, stmt-b-)
  • 200+ randomized requests per endpoint with fixed seed (42) for deterministic failure reporting

Test Coverage

  1. SubscriptionService.GetDetail cross-tenant isolation
  2. StatementService.ListByCustomer cross-tenant isolation
  3. PlanRepository.List tenant scoping

Code Quality Fixes

  • Fixed syntax errors in featureflags, partition, statements, audit, svid, otel_handler
  • Fixed import issues: gin-gonic/gin typo, brotli import path (klauspost->andybalholm)
  • Updated go.mod/go.sum with andybalholm/brotli v1.2.3

Test Properties Verified

  • Deterministic: Fixed seed (42) for reproducible failures
  • Property-based: 200+ randomized requests per endpoint
  • Isolation guarantees: Cross-tenant access always returns ErrNotFound/nil
  • Overlapping IDs: Tenant A and B have colliding ID patterns to stress-test isolation

Closes #782

…ptions, and statements (Stellabill#782)

Implement property-style integration test that seeds two-tenant fixtures and
exhaustively probes read endpoints to assert tenant isolation.

Changes:
- Add internal/service/tenant_isolation_property_test.go with property-based
  tests for cross-tenant isolation across plans, subscriptions, and statements
- Fix syntax errors in featureflags, partition, statements, audit, svid, otel_handler
- Fix import issues: gin-gonic/gin typo, brotli import path (klauspost->andybalholm)
- Update go.mod/go.sum with andybalholm/brotli v1.2.3

The test seeds two tenants (tenant-alpha, tenant-beta) with overlapping IDs
and drives 200+ randomized requests per read endpoint to verify:
- SubscriptionService.GetDetail rejects cross-tenant access
- StatementService.ListByCustomer rejects cross-tenant access
- PlanRepository.List enforces tenant scoping

Fixed seed (42) for deterministic failure reporting.
Closes Stellabill#782
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@supreme2580 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@thlpkee20-wq
thlpkee20-wq merged commit 8b1409e into Stellabill:main Aug 31, 2026
8 of 23 checks passed
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.

Add multi-tenant isolation property tests across plans, subscriptions and statements

2 participants