Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into 0xced-IDatabaseCon…
Browse files Browse the repository at this point in the history
…tainer
  • Loading branch information
HofmeisterAn committed Oct 14, 2023
2 parents 5762b04 + 6e31cf3 commit 9dd0cbb
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/Testcontainers/Containers/DockerContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace DotNet.Testcontainers.Containers
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Docker.DotNet;
using Docker.DotNet.Models;
using DotNet.Testcontainers.Clients;
using DotNet.Testcontainers.Configurations;
Expand Down Expand Up @@ -472,23 +471,16 @@ protected virtual async Task UnsafeStopAsync(CancellationToken ct = default)
await _client.StopAsync(_container.ID, ct)
.ConfigureAwait(false);

try
{
_container = await _client.Container.ByIdAsync(_container.ID, ct)
.ConfigureAwait(false);
}
catch (DockerApiException)
{
_container = new ContainerInspectResponse();
}
_container = await _client.Container.ByIdAsync(_container.ID, ct)
.ConfigureAwait(false);

Stopped?.Invoke(this, EventArgs.Empty);
}

/// <inheritdoc />
protected override bool Exists()
{
return ContainerHasBeenCreatedStates.HasFlag(State);
return _container != null && ContainerHasBeenCreatedStates.HasFlag(State);
}
}
}

0 comments on commit 9dd0cbb

Please sign in to comment.