Skip to content

Conversation

adborroto
Copy link

What does this PR do?

This PR adds a new SpiceDB module to the Testcontainers for .NET library, providing seamless integration for testing applications that use SpiceDB (Google Zanzibar-inspired permissions database).

Key components added:

  • SpiceDBContainer: Container wrapper with SpiceDB-specific functionality including connection string generation
  • SpiceDBBuilder: Fluent builder for configuring SpiceDB containers with sensible defaults
  • SpiceDBConfiguration: Configuration class following the established Testcontainers pattern
  • Comprehensive test suite: Full test coverage with container lifecycle, port mapping, and command execution tests
  • Documentation: Complete module documentation following the established format used by other modules

Technical details:

  • Uses authzed/spicedb:v1.45.1 Docker image
  • Exposes gRPC API on port 50051
  • Implements wait strategy using SpiceDB CLI ping command
  • Follows the standard Testcontainers .NET module patterns and conventions

Why is it important?

SpiceDB is gaining significant adoption as a robust authorization service, especially for applications requiring fine-grained permissions at scale. This module enables developers to:

  1. Test authorization logic reliably: Write integration tests against a real SpiceDB instance without complex setup
  2. Improve development velocity: Spin up SpiceDB containers effortlessly in test environments
  3. Ensure consistency: Test against the same SpiceDB version used in production
  4. Simplify CI/CD: No need for external SpiceDB dependencies in testing pipelines

This addition expands Testcontainers' coverage into the authorization/permissions domain, complementing the existing database and messaging modules.

Related issues

  • Relates to expanding Testcontainers module ecosystem
  • Addresses community requests for SpiceDB testing support

How to test this PR

Prerequisites:

  • Docker installed and running
  • .NET 9.0 SDK

Testing steps:

  1. Build the solution:

    dotnet build
  2. Run SpiceDB tests specifically:

    dotnet test tests/Testcontainers.SpiceDB.Tests/
  3. Run all tests to ensure no regressions:

    dotnet test
  4. Verify documentation builds correctly:

    # Check that the documentation is properly formatted
    cat docs/modules/spicedb.md

Expected test results:

  • ✅ Container starts successfully
  • ✅ gRPC port (50051) is properly mapped
  • ✅ SpiceDB commands execute successfully
  • ✅ Container lifecycle management works correctly

Follow-ups

Potential enhancements for future PRs:

  1. Enhanced connection string implementation: Currently returns null - should return proper gRPC connection string format
  2. SpiceDB-specific helper methods: Add methods for schema management, relationship operations
  3. Configuration presets: Add builder methods for common SpiceDB configurations (development, testing, etc.)
  4. Client library integration examples: Demonstrate usage with popular SpiceDB client libraries
  5. Performance testing utilities: Add helpers for load testing authorization scenarios

Documentation improvements:

  • Add code examples showing integration with SpiceDB client libraries
  • Include

Copy link

netlify bot commented Jul 31, 2025

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit c481674
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/689324a975dd3b0008712cd6
😎 Deploy Preview https://deploy-preview-1498--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@adborroto adborroto marked this pull request as draft July 31, 2025 12:17
@adborroto adborroto marked this pull request as ready for review August 1, 2025 08:13
@HofmeisterAn HofmeisterAn added module An official Testcontainers module enhancement New feature or request labels Sep 21, 2025
@HofmeisterAn HofmeisterAn force-pushed the develop branch 3 times, most recently from 4900ecd to 8fa5f1b Compare October 3, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module An official Testcontainers module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants