Skip to content

Commit ab69214

Browse files
committed
Migrate HealthChecks.Solr tests to Testcontainers
1 parent 59c9f73 commit ab69214

File tree

8 files changed

+3132
-3
lines changed

8 files changed

+3132
-3
lines changed

test/HealthChecks.Solr.Tests/Functional/SolrHealthCheckTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace HealthChecks.Solr.Tests.Functional;
55

6-
public class solr_healthcheck_should
6+
public class solr_healthcheck_should(SolrContainerFixture solrFixture) : IClassFixture<SolrContainerFixture>
77
{
88
[Fact]
99
public async Task be_healthy_if_solr_is_available()
@@ -12,7 +12,7 @@ public async Task be_healthy_if_solr_is_available()
1212
.ConfigureServices(services =>
1313
{
1414
services.AddHealthChecks()
15-
.AddSolr("http://localhost:8983/solr", "solrcore", tags: ["solr"]);
15+
.AddSolr(solrFixture.GetConnectionString(), "solrcore", tags: ["solr"]);
1616
})
1717
.Configure(app =>
1818
{
@@ -35,7 +35,7 @@ public async Task be_unhealthy_if_solr_ping_is_disabled()
3535
.ConfigureServices(services =>
3636
{
3737
services.AddHealthChecks()
38-
.AddSolr("http://localhost:8893/solr", "solrcoredown", tags: ["solr"]);
38+
.AddSolr(solrFixture.GetConnectionString(), "solrcoredown", tags: ["solr"]);
3939
})
4040
.Configure(app =>
4141
{

test/HealthChecks.Solr.Tests/HealthChecks.Solr.Tests.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,14 @@
44
<ProjectReference Include="..\..\src\HealthChecks.Solr\HealthChecks.Solr.csproj" />
55
</ItemGroup>
66

7+
<ItemGroup>
8+
<PackageReference Include="Testcontainers" />
9+
</ItemGroup>
10+
11+
<ItemGroup>
12+
<None Update="Resources/**">
13+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
14+
</None>
15+
</ItemGroup>
16+
717
</Project>

test/HealthChecks.Solr.Tests/Resources/solr/configsets/solrcore/conf/managed-schema

Lines changed: 296 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)