-
-
Notifications
You must be signed in to change notification settings - Fork 342
feat(spicedb): add testcontainer module for SpiceDB #1498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
24a5540
b494bdd
7de600c
dda1cf8
769a15b
bb51ca6
c4cbd37
146403a
f71a8fb
c481674
3b49614
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,9 @@ | |||||||||||||||||
| </PropertyGroup> | ||||||||||||||||||
| <ItemGroup> | ||||||||||||||||||
| <PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.1"/> | ||||||||||||||||||
| <PackageVersion Include="Docker.DotNet.Enhanced.X509" Version="3.128.3"/> | ||||||||||||||||||
| <PackageVersion Include="Docker.DotNet.Enhanced" Version="3.128.3"/> | ||||||||||||||||||
| <PackageVersion Include="Grpc.Core" Version="2.46.6" /> | ||||||||||||||||||
| <PackageVersion Include="Docker.DotNet.Enhanced.X509" Version="3.129.0"/> | ||||||||||||||||||
| <PackageVersion Include="Docker.DotNet.Enhanced" Version="3.129.0"/> | ||||||||||||||||||
|
Comment on lines
+8
to
12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve duplicate central package versions. Adding the 3.128.3 entries for - <PackageVersion Include="Docker.DotNet.Enhanced.X509" Version="3.128.3"/>
- <PackageVersion Include="Docker.DotNet.Enhanced" Version="3.128.3"/>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| <PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0"/> | ||||||||||||||||||
|
|
@@ -61,6 +64,8 @@ | |||||||||||||||||
| <PackageVersion Include="Google.Cloud.Firestore" Version="3.1.0"/> | ||||||||||||||||||
| <PackageVersion Include="Google.Cloud.PubSub.V1" Version="3.5.0"/> | ||||||||||||||||||
| <PackageVersion Include="Google.Cloud.Storage.V1" Version="4.6.0"/> | ||||||||||||||||||
| <PackageVersion Include="Grpc.HealthCheck" Version="2.60.0"/> | ||||||||||||||||||
| <PackageVersion Include="Grpc.Net.Client" Version="2.60.0"/> | ||||||||||||||||||
| <PackageVersion Include="InfluxDB.Client" Version="4.18.0"/> | ||||||||||||||||||
| <PackageVersion Include="JanusGraph.Net" Version="1.0.0"/> | ||||||||||||||||||
| <PackageVersion Include="Keycloak.Net.Core" Version="1.0.20"/> | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,6 +280,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Xunit.Tests" | |
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.XunitV3.Tests", "tests\Testcontainers.XunitV3.Tests\Testcontainers.XunitV3.Tests.csproj", "{B2E8B7FB-7D1E-4DD3-A25E-34DE4386B1EB}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.SpiceDB", "src\Testcontainers.SpiceDB\Testcontainers.SpiceDB.csproj", "{64B27088-14DC-4CA2-B24E-5D0D5BA14355}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.SpiceDB.Tests", "tests\Testcontainers.SpiceDB.Tests\Testcontainers.SpiceDB.Tests.csproj", "{21D155EB-A843-4D4D-84E1-5C913217BE89}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
|
|
@@ -806,6 +810,18 @@ Global | |
| {B2E8B7FB-7D1E-4DD3-A25E-34DE4386B1EB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {B2E8B7FB-7D1E-4DD3-A25E-34DE4386B1EB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {B2E8B7FB-7D1E-4DD3-A25E-34DE4386B1EB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Release|Any CPU.Build.0 = Release|Any CPU | ||
|
Comment on lines
+817
to
+820
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: GUID mismatch detected. Lines 817-820 reference GUID - {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A9F554E5-9183-4F8A-B226-58DD46BB2060}.Release|Any CPU.Build.0 = Release|Any CPU
+ {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {64B27088-14DC-4CA2-B24E-5D0D5BA14355}.Release|Any CPU.Build.0 = Release|Any CPU
🤖 Prompt for AI Agents |
||
| {21D155EB-A843-4D4D-84E1-5C913217BE89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {21D155EB-A843-4D4D-84E1-5C913217BE89}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {21D155EB-A843-4D4D-84E1-5C913217BE89}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {21D155EB-A843-4D4D-84E1-5C913217BE89}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(SolutionProperties) = preSolution | ||
| HideSolutionNode = FALSE | ||
|
|
@@ -942,5 +958,7 @@ Global | |
| {EBA72C3B-57D5-43FF-A5B4-3D55B3B6D4C2} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} | ||
| {E901DF14-6F05-4FC2-825A-3055FAD33561} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} | ||
| {B2E8B7FB-7D1E-4DD3-A25E-34DE4386B1EB} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} | ||
| {64B27088-14DC-4CA2-B24E-5D0D5BA14355} = {673F23AE-7694-4BB9-ABD4-136D6C13634E} | ||
| {21D155EB-A843-4D4D-84E1-5C913217BE89} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF} | ||
| EndGlobalSection | ||
| EndGlobal | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # SpiceDB | ||
|
|
||
| [SpiceDB](https://authzed.com/spicedb/) is an open-source, Google Zanzibar-inspired permissions database that provides a centralized service to store, compute, and validate application permissions. It enables fine-grained authorization at scale with a flexible relationship-based permission model. | ||
|
|
||
| Add the following dependency to your project file: | ||
|
|
||
| ```shell title="NuGet" | ||
| dotnet add package Testcontainers.SpiceDB | ||
| ``` | ||
|
|
||
| You can start a SpiceDB container instance from any .NET application. This example uses xUnit.net's `IAsyncLifetime` interface to manage the lifecycle of the container. The container is started in the `InitializeAsync` method before the test method runs, ensuring that the environment is ready for testing. After the test completes, the container is removed in the `DisposeAsync` method. | ||
|
|
||
| === "Usage Example" | ||
|
|
||
| ````csharp | ||
| public sealed class SpiceDBContainerTest : IAsyncLifetime | ||
| { | ||
| private readonly SpiceDBContainer \_spicedbContainer = new SpiceDBBuilder().Build(); | ||
|
|
||
| public Task InitializeAsync() | ||
| { | ||
| return _spicedbContainer.StartAsync(); | ||
| } | ||
|
|
||
| public Task DisposeAsync() | ||
| { | ||
| return _spicedbContainer.DisposeAsync().AsTask(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task SpiceDBContainer_IsRunning_ReturnsTrue() | ||
| { | ||
| // Given | ||
| var containerState = await _spicedbContainer.GetStateAsync(); | ||
|
|
||
| // ... | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
|
Comment on lines
+13
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the tabbed code block fencing. The -=== "Usage Example"
-
-````csharp
-public sealed class SpiceDBContainerTest : IAsyncLifetime
-{
-private readonly SpiceDBContainer \_spicedbContainer = new SpiceDBBuilder().Build();
-
- public Task InitializeAsync()
- {
- return _spicedbContainer.StartAsync();
- }
-
- public Task DisposeAsync()
- {
- return _spicedbContainer.DisposeAsync().AsTask();
- }
-
- [Fact]
- public async Task SpiceDBContainer_IsRunning_ReturnsTrue()
- {
- // Given
- var containerState = await _spicedbContainer.GetStateAsync();
-
- // ...
- }
- }
- ```
+=== "Usage Example"
+
+ ```csharp
+ public sealed class SpiceDBContainerTest : IAsyncLifetime
+ {
+ private readonly SpiceDBContainer _spicedbContainer = new SpiceDBBuilder().Build();
+
+ public Task InitializeAsync()
+ {
+ return _spicedbContainer.StartAsync();
+ }
+
+ public Task DisposeAsync()
+ {
+ return _spicedbContainer.DisposeAsync().AsTask();
+ }
+
+ [Fact]
+ public async Task SpiceDBContainer_IsRunning_ReturnsTrue()
+ {
+ // Given
+ var containerState = await _spicedbContainer.GetStateAsync();
+
+ // ...
+ }
+ }
+ ```🤖 Prompt for AI Agents |
||
| The test example uses the following NuGet dependencies: | ||
|
|
||
| === "Package References" | ||
| `xml | ||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
| <PackageReference Include="xunit" /> | ||
| <PackageReference Include="xunit.runner.visualstudio" /> | ||
| <PackageReference Include="Testcontainers.SpiceDB" /> | ||
| </ItemGroup> | ||
| ` | ||
|
|
||
| To execute the tests, use the command `dotnet test` from a terminal. | ||
|
|
||
| --8<-- "docs/modules/\_call_out_test_projects.txt" | ||
| ```` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| root = true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove nested Setting 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| namespace Testcontainers.SpiceDB; | ||
|
|
||
| /// <inheritdoc cref="ContainerBuilder{TBuilderEntity, TContainerEntity, TConfigurationEntity}" /> | ||
| [PublicAPI] | ||
| public sealed class SpiceDBBuilder : ContainerBuilder<SpiceDBBuilder, SpiceDBContainer, SpiceDBConfiguration> | ||
| { | ||
| public const string SpiceDBImage = "authzed/spicedb:v1.45.1"; | ||
|
|
||
| public const ushort SpiceDBgRPCPort = 50051; | ||
|
|
||
| public const ushort SpiceDBgHTTPPort = 8443; | ||
|
|
||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBBuilder" /> class. | ||
| /// </summary> | ||
| public SpiceDBBuilder() | ||
| : this(new SpiceDBConfiguration()) | ||
| { | ||
| DockerResourceConfiguration = Init().DockerResourceConfiguration; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBBuilder" /> class. | ||
| /// </summary> | ||
| /// <param name="resourceConfiguration">The Docker resource configuration.</param> | ||
| private SpiceDBBuilder(SpiceDBConfiguration resourceConfiguration) | ||
| : base(resourceConfiguration) | ||
| { | ||
| DockerResourceConfiguration = resourceConfiguration; | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override SpiceDBConfiguration DockerResourceConfiguration { get; } | ||
|
|
||
| /// <inheritdoc /> | ||
| public override SpiceDBContainer Build() | ||
| { | ||
| Validate(); | ||
| return new SpiceDBContainer(DockerResourceConfiguration); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override SpiceDBBuilder Init() | ||
| { | ||
| return base.Init() | ||
| .WithImage(SpiceDBImage) | ||
| .WithPortBinding(SpiceDBgRPCPort, true) | ||
| .WithPortBinding(SpiceDBgHTTPPort, true) | ||
| .WithCommand("serve", $"--grpc-preshared-key={DockerResourceConfiguration.GrpcPresharedKey}", $"--datastore-engine={DockerResourceConfiguration.DatastoreEngine}", $"--log-level=info") | ||
| .WithWaitStrategy(Wait.ForUnixContainer().UntilMessageIsLogged("grpc server started serving")); | ||
|
Comment on lines
+46
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TLS flag in configuration is ignored, breaking HTTPS clients
|
||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override SpiceDBBuilder Clone(IResourceConfiguration<CreateContainerParameters> resourceConfiguration) | ||
| { | ||
| return Merge(DockerResourceConfiguration, new SpiceDBConfiguration(resourceConfiguration)); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override SpiceDBBuilder Clone(IContainerConfiguration resourceConfiguration) | ||
| { | ||
| return Merge(DockerResourceConfiguration, new SpiceDBConfiguration(resourceConfiguration)); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| protected override SpiceDBBuilder Merge(SpiceDBConfiguration oldValue, SpiceDBConfiguration newValue) | ||
| { | ||
| return new SpiceDBBuilder(new SpiceDBConfiguration(oldValue, newValue)); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| namespace Testcontainers.SpiceDB; | ||
|
|
||
| /// <inheritdoc cref="ContainerConfiguration" /> | ||
| [PublicAPI] | ||
| public sealed class SpiceDBConfiguration : ContainerConfiguration | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBConfiguration" /> class. | ||
| /// </summary> | ||
| public SpiceDBConfiguration(string grpcPresharedKey = "mysecret", string datastoreEngine = "memory", bool? tslEnabled = false) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo: "Tsl" should be "Tls". The parameter name - public SpiceDBConfiguration(string grpcPresharedKey = "mysecret", string datastoreEngine = "memory", bool? tslEnabled = false)
+ public SpiceDBConfiguration(string grpcPresharedKey = "mysecret", string datastoreEngine = "memory", bool? tlsEnabled = false)
{
GrpcPresharedKey = grpcPresharedKey;
DatastoreEngine = datastoreEngine;
- TslEnabled = tslEnabled.GetValueOrDefault(false);
+ TlsEnabled = tlsEnabled.GetValueOrDefault(false);
}
- public bool TslEnabled { get; set; }
+ public bool TlsEnabled { get; set; }Note: This change will also require updates in Also applies to: 17-17 🤖 Prompt for AI Agents |
||
| { | ||
| GrpcPresharedKey = grpcPresharedKey; | ||
| DatastoreEngine = datastoreEngine; | ||
| TslEnabled = tslEnabled.GetValueOrDefault(false); | ||
| } | ||
|
|
||
| public bool TslEnabled { get; set; } | ||
|
|
||
| public string GrpcPresharedKey { get; set; } | ||
|
|
||
| public string DatastoreEngine { get; set; } | ||
|
|
||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBConfiguration" /> class. | ||
| /// </summary> | ||
| /// <param name="resourceConfiguration">The Docker resource configuration.</param> | ||
| public SpiceDBConfiguration(IResourceConfiguration<CreateContainerParameters> resourceConfiguration) | ||
| : base(resourceConfiguration) | ||
| { | ||
| // Passes the configuration upwards to the base implementations to create an updated immutable copy. | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBConfiguration" /> class. | ||
| /// </summary> | ||
| /// <param name="resourceConfiguration">The Docker resource configuration.</param> | ||
| public SpiceDBConfiguration(IContainerConfiguration resourceConfiguration) | ||
| : base(resourceConfiguration) | ||
| { | ||
| // Passes the configuration upwards to the base implementations to create an updated immutable copy. | ||
| } | ||
|
Comment on lines
+24
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify property initialization in copy constructors. The constructors at lines 28-32 and 38-42 rely on the base class to handle configuration copying. Ensure that Run the following script to check how similar modules handle this pattern: 🏁 Script executed: #!/bin/bash
# Search for similar configuration patterns in other modules
rg -A 10 'public.*Configuration.*IResourceConfiguration' --type cs -g 'src/Testcontainers.*/Configuration.cs' | head -100Length of output: 148 I'll help verify this review comment by examining the codebase structure and comparing patterns. Let me gather the necessary information. Length of output: 1408 🏁 Script executed: #!/bin/bash
# Examine the SpiceDBConfiguration.cs file
cat 'src/Testcontainers.SpiceDB/SpiceDBConfiguration.cs'Length of output: 2533 🏁 Script executed: #!/bin/bash
# Find and examine the base ContainerConfiguration class
fd -t f 'ContainerConfiguration\.cs$' --type fLength of output: 142 🏁 Script executed: #!/bin/bash
# Look for similar configuration patterns in other Testcontainers modules
find src/Testcontainers.* -name 'Configuration.cs' -type f | head -20Length of output: 0 🏁 Script executed: #!/bin/bash
# Search for how other modules define their configurations
rg 'class.*Configuration.*:.*Configuration' --type cs -A 5 -B 2 | head -150Length of output: 13275 I need to examine the base class and compare with other similar modules to verify the concern. Let me inspect the implementations. Length of output: 9313 🏁 Script executed: #!/bin/bash
# Examine WeaviateConfiguration to see how it handles derived properties
cat 'src/Testcontainers.Weaviate/WeaviateConfiguration.cs'Length of output: 2164 🏁 Script executed: #!/bin/bash
# Examine RedisConfiguration for comparison
cat 'src/Testcontainers.Redis/RedisConfiguration.cs'Length of output: 2116 🏁 Script executed: #!/bin/bash
# Examine RavenDbConfiguration for comparison
cat 'src/Testcontainers.RavenDb/RavenDbConfiguration.cs'Length of output: 2148 Add explicit property initialization to copy constructors to preserve SpiceDB-specific configuration. The constructors at lines 28-32 and 38-42 rely on base class handling, but The copy constructor at lines 54-60 also needs to explicitly merge the derived properties like the base class does with Update all copy constructors to preserve SpiceDB-specific properties: public SpiceDBConfiguration(SpiceDBConfiguration oldValue, SpiceDBConfiguration newValue)
: base(oldValue, newValue)
{
TslEnabled = newValue.TslEnabled;
GrpcPresharedKey = newValue.GrpcPresharedKey;
DatastoreEngine = newValue.DatastoreEngine;
}🤖 Prompt for AI Agents |
||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBConfiguration" /> class. | ||
| /// </summary> | ||
| /// <param name="resourceConfiguration">The Docker resource configuration.</param> | ||
| public SpiceDBConfiguration(SpiceDBConfiguration resourceConfiguration) | ||
| : this(new SpiceDBConfiguration(), resourceConfiguration) | ||
| { | ||
| // Passes the configuration upwards to the base implementations to create an updated immutable copy. | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBConfiguration" /> class. | ||
| /// </summary> | ||
| /// <param name="oldValue">The old Docker resource configuration.</param> | ||
| /// <param name="newValue">The new Docker resource configuration.</param> | ||
| public SpiceDBConfiguration(SpiceDBConfiguration oldValue, SpiceDBConfiguration newValue) | ||
| : base(oldValue, newValue) | ||
| { | ||
| } | ||
|
Comment on lines
+54
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Merge constructor must copy SpiceDB-specific properties. The merge constructor doesn't copy the SpiceDB-specific properties ( public SpiceDBConfiguration(SpiceDBConfiguration oldValue, SpiceDBConfiguration newValue)
: base(oldValue, newValue)
{
+ GrpcPresharedKey = BuildConfiguration.Combine(oldValue, newValue, @this => @this.GrpcPresharedKey);
+ DatastoreEngine = BuildConfiguration.Combine(oldValue, newValue, @this => @this.DatastoreEngine);
+ TslEnabled = BuildConfiguration.Combine(oldValue, newValue, @this => @this.TslEnabled);
}
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| using System.Threading; | ||
| using Health = Grpc.Health.V1.Health; | ||
|
|
||
| namespace Testcontainers.SpiceDB; | ||
|
|
||
| /// <inheritdoc cref="DockerContainer" /> | ||
| [PublicAPI] | ||
| public sealed class SpiceDBContainer : DockerContainer | ||
| { | ||
| SpiceDBConfiguration _configuration; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="SpiceDBContainer" /> class. | ||
| /// </summary> | ||
| /// <param name="configuration">The container configuration.</param> | ||
| public SpiceDBContainer(SpiceDBConfiguration configuration) | ||
| : base(configuration) | ||
| { | ||
| _configuration = configuration; | ||
| } | ||
|
|
||
| public string GetGrpcConnectionString() | ||
| { | ||
| var scheme = _configuration.TslEnabled ? Uri.UriSchemeHttps : Uri.UriSchemeHttp; | ||
| var endpoint = new UriBuilder(scheme, Hostname, GetMappedPublicPort(SpiceDBBuilder.SpiceDBgRPCPort)); | ||
| return endpoint.ToString(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>net8.0;net9.0;netstandard2.0;netstandard2.1</TargetFrameworks> | ||
| <LangVersion>latest</LangVersion> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Grpc.HealthCheck" /> | ||
| <PackageReference Include="JetBrains.Annotations" VersionOverride="2023.3.0" PrivateAssets="All"/> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Testcontainers\Testcontainers.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| global using System; | ||
| global using System.Threading.Tasks; | ||
| global using Docker.DotNet.Models; | ||
| global using DotNet.Testcontainers.Builders; | ||
| global using DotNet.Testcontainers.Configurations; | ||
| global using DotNet.Testcontainers.Containers; | ||
| global using JetBrains.Annotations; | ||
| global using Grpc.Health.V1; | ||
| global using Grpc.Core; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| root = true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep inheriting the repo .editorconfig. Marking this test-project .editorconfig as 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate
pull_requestevent trigger and consolidate overlappingbrancheskeys.YAML does not support duplicate keys at the same nesting level. The current configuration has two
pull_requesttriggers (lines 7–9 and lines 11–12), and the second one will override the first. Additionally, within the firstpull_requestblock, there are two conflictingbrancheskeys (lines 8 and 10), where line 10 will override line 8.This means the
paths-ignorefilter and thefeature/*branch pattern from lines 5–6 will be lost for pull_request events. The workflow will fall back to the legacy configuration on lines 11–12.Apply this diff to remove the duplicate trigger and consolidate the configuration:
pull_request: branches: [develop, main] paths-ignore: ["docs/**", "examples/**"] - branches: [ develop, main, bugfix/*, feature/* ] - pull_request: - branches: [ develop, main ]🧰 Tools
🪛 actionlint (1.7.8)
10-10: key "branches" is duplicated in "pull_request" section. previously defined at line:8,col:5
(syntax-check)
11-11: key "pull_request" is duplicated in "on" section. previously defined at line:7,col:3
(syntax-check)
🪛 YAMLlint (1.37.1)
[error] 10-10: duplication of key "branches" in mapping
(key-duplicates)
[error] 11-11: duplication of key "pull_request" in mapping
(key-duplicates)
🤖 Prompt for AI Agents