-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add integration tests * Improving integration test, fixing non-exhaustive switch and adding test for that * Small regex fix
- Loading branch information
Showing
5 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Text.RegularExpressions; | ||
using DotNet.Testcontainers.Builders; | ||
using NUnit.Framework; | ||
|
||
namespace RqliteDotnet.IntegrationTest; | ||
|
||
public class RqliteClientTests | ||
{ | ||
private const int Port = 4001; | ||
|
||
[Test] | ||
public async Task RqliteClientPing_Works() | ||
{ | ||
var container = new ContainerBuilder() | ||
.WithImage("rqlite/rqlite:8.32.7") | ||
.WithPortBinding(Port, true) | ||
.WithWaitStrategy(Wait.ForUnixContainer().UntilHttpRequestIsSucceeded(r => r.ForPort(Port))) | ||
.Build(); | ||
|
||
await container.StartAsync().ConfigureAwait(false); | ||
|
||
var url = $"http://{container.Hostname}:{container.GetMappedPublicPort(Port)}"; | ||
var client = new RqliteClient(url); | ||
|
||
var version = await client.Ping(); | ||
|
||
Assert.That(version, Is.Not.Empty); | ||
Assert.That(Regex.IsMatch(version, @"v\d+.\d+\.*")); //v8.10.1 | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
RqliteDotnet.IntegrationTest/RqliteDotnet.IntegrationTest.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" /> | ||
<PackageReference Include="NUnit" Version="4.2.2" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" /> | ||
<PackageReference Include="Testcontainers" Version="4.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\RqliteDotnet\RqliteDotnet.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters