Skip to content

Commit

Permalink
Switch to pre-built Cassandra Docker image (dotnet#9076)
Browse files Browse the repository at this point in the history
* Switch to pre-built Cassandra Docker image

Removed `Cassandra.dockerfile` and related custom image build code.
Updated `CassandraContainer.cs` to use a pre-built Cassandra image
from Docker Hub, specified by the `CASSANDRAVERSION` environment
variable.

* Matching category to run clustering tests

* Update .github/workflows/ci.yml

---------

Co-authored-by: Reuben Bond <[email protected]>
  • Loading branch information
rkargMsft and ReubenBond authored Jul 25, 2024
1 parent 92e0bf3 commit 0de83d2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
3.1.x
8.0.x
- name: Test
run: dotnet test --filter "Category=${{ matrix.provider }}&(Category=BVT|Category=SlowBVT|Category=Functional)" --blame-hang-timeout 10m --logger "trx" -- -parallel none -noshadow
run: dotnet test --filter "Category=${{ matrix.provider }}&(Category=BVT|Category=SlowBVT|Category=Clustering)" --blame-hang-timeout 10m --logger "trx" -- -parallel none -noshadow
env:
CASSANDRAVERSION: ${{ matrix.dbversion }}
- name: Archive Test Results
Expand Down
20 changes: 0 additions & 20 deletions test/Extensions/Tester.Cassandra/Cassandra.dockerfile

This file was deleted.

22 changes: 6 additions & 16 deletions test/Extensions/Tester.Cassandra/Clustering/CassandraContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,14 @@ public class CassandraContainer
private readonly Lazy<Task<(IContainer container, ushort exposedPort, Cluster cluster, ISession session)>> _innerRunImage =
new(async () =>
{
var cassandraImage = new ImageFromDockerfileBuilder()
.WithDockerfileDirectory(CommonDirectoryPath.GetProjectDirectory(Directory.GetCurrentDirectory()), string.Empty)
.WithDockerfile("Cassandra.dockerfile")
.WithBuildArgument("CASSANDRAVERSION", Environment.GetEnvironmentVariable("CASSANDRAVERSION"))
.Build();

var imageTask = cassandraImage.CreateAsync();

await imageTask;

var containerPort = 9042;

var builder = new ContainerBuilder()
.WithImage(cassandraImage)
.WithPortBinding(containerPort, true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(containerPort));

var container = builder.Build();
var container = new ContainerBuilder()
.WithImage("cassandra:" + Environment.GetEnvironmentVariable("CASSANDRAVERSION"))
.WithPortBinding(containerPort, true)
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(containerPort))
.Build()
;

await container.StartAsync();

Expand Down
6 changes: 0 additions & 6 deletions test/Extensions/Tester.Cassandra/Tester.Cassandra.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,4 @@

</ItemGroup>

<ItemGroup>
<None Update="Cassandra.dockerfile">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

0 comments on commit 0de83d2

Please sign in to comment.