Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Datadog.Trace.ClrProfiler.IntegrationTests.Helpers;
using Datadog.Trace.Configuration;
using Datadog.Trace.TestHelpers;
using Datadog.Trace.TestHelpers.AutoInstrumentation.Containers;
Expand All @@ -21,7 +22,8 @@ namespace Datadog.Trace.ClrProfiler.IntegrationTests
[Trait("RequiresDockerDependency", "true")]
[Trait("DockerGroup", "2")]
[UsesVerify]
public class AerospikeTests : TracingIntegrationTest, IClassFixture<AerospikeFixture>
[Collection(AerospikeCollection.Name)]
public class AerospikeTests : TracingIntegrationTest
{
public AerospikeTests(ITestOutputHelper output, AerospikeFixture aerospikeFixture)
: base("Aerospike", output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />

<PackageReference Include="Testcontainers" Version="3.6.0" />
<PackageReference Include="Testcontainers" Version="4.11.0" />
<PackageReference Include="StrongNamer" Version="0.2.5" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// <copyright file="ContainersCollection.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>
#pragma warning disable SA1649 // File name should match first type name (this will just store all the classes)
#pragma warning disable SA1402 // File may only contain a single type (this will just store all the classes)
using Datadog.Trace.TestHelpers.AutoInstrumentation.Containers;
using Xunit;

namespace Datadog.Trace.ClrProfiler.IntegrationTests.Helpers
{
[CollectionDefinition(Name)]

public class AerospikeCollection : ICollectionFixture<AerospikeFixture>
{
public const string Name = "Aerospike";
}
}

#pragma warning restore SA1649 // File name should match first type name
#pragma warning restore SA1402 // File may only contain a single type
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@ protected override async Task InitializeResources(Action<string, object> registe
// pinning to a known good version because the latest version
// (6.3.0.5 at time of issue) causes 'Server memory error' and flake
// Keep syncronized image version with docker-compose.yml
var container = new ContainerBuilder()
.WithImage("aerospike/aerospike-server:6.2.0.6")
var container = new ContainerBuilder("aerospike/aerospike-server:6.2.0.6")
.WithPortBinding(AerospikePort, true)
.WithCreateParameterModifier(p =>
{
p.HostConfig ??= new HostConfig();
p.HostConfig.Ulimits = new List<Ulimit>
{
p.HostConfig ??= new HostConfig();
p.HostConfig.Ulimits = new List<Ulimit>
{
// Aerospike requires a minimum of 15000 file descriptors, otherwise it'll fail to start
// Some versions of dockerengine set a lower limit (1024)
new Ulimit { Name = "nofile", Soft = 15000, Hard = 15000 }
};
})
.WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(AerospikePort))
})
.WithWaitStrategy(Wait.ForUnixContainer().UntilInternalTcpPortIsAvailable(AerospikePort))
.Build();

await container.StartAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,28 @@ public abstract class ContainerFixture : IAsyncLifetime

public async Task InitializeAsync()
{
_resources = await ContainersRegistry.GetOrAdd(GetType(), InitializeResources);
_resources = await InitializeResources().ConfigureAwait(false);
}

// Do not implement, the ContainersRegistry is responsible for disposing the containers
public Task DisposeAsync() => Task.CompletedTask;
public async Task DisposeAsync()
{
if (_resources is null)
{
return;
}

foreach (var resource in _resources.Values)
{
if (resource is IAsyncDisposable asyncDisposable)
{
await asyncDisposable.DisposeAsync().ConfigureAwait(false);
}
else if (resource is IDisposable disposable)
{
disposable.Dispose();
}
}
}

public virtual IEnumerable<KeyValuePair<string, string>> GetEnvironmentVariables() => Enumerable.Empty<KeyValuePair<string, string>>();

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="SharpPdb" Version="1.0.4" />
<PackageReference Include="Testcontainers" Version="3.6.0" />
<PackageReference Include="Testcontainers" Version="4.11.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading