Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️ Fails to create MySqlTestcontainer with Docker 4.13.0 (89412) #634

Closed
macalbert opened this issue Oct 24, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@macalbert
Copy link

macalbert commented Oct 24, 2022

Hi!
After updating the version of Docker from 4.12 to 4.13, I can't start the container MySqlTestcontainer, and an exception like the following is thrown:

Did not expect any exception, but found Newtonsoft.Json.JsonReaderException with message "Error parsing undefined value. Path '', line 1, position 2."
     at Newtonsoft.Json.JsonTextReader.MatchAndSetAsync(String value, JsonToken newToken, Object tokenValue, CancellationToken cancellationToken)
     at Newtonsoft.Json.JsonTextReader.ParseValueAsync(CancellationToken cancellationToken)
     at Docker.DotNet.Models.StreamUtil.MonitorStreamForMessagesAsync[T](Task`1 streamTask, DockerClient client, CancellationToken cancellationToken, IProgress`1 progress)
     at Docker.DotNet.Models.StreamUtil.MonitorResponseForMessagesAsync[T](Task`1 responseTask, DockerClient client, CancellationToken cancel, IProgress`1 progress)
     at DotNet.Testcontainers.Clients.DockerImageOperations.CreateAsync(IDockerImage image, IDockerRegistryAuthenticationConfiguration dockerRegistryAuthConfig, CancellationToken ct)
     at DotNet.Testcontainers.Clients.TestcontainersClient.RunAsync(ITestcontainersConfiguration configuration, CancellationToken ct)
     at DotNet.Testcontainers.Containers.TestcontainersContainer.Create(CancellationToken ct)
     at DotNet.Testcontainers.Containers.TestcontainersContainer.StartAsync(CancellationToken ct)
     at Onclusive.Shared.Tests.DbContainerTest.<>c__DisplayClass0_0.<<Should_CreateDbContainer_When_ConfigurationIsValid>b__0>d.MoveNext() in C:\Users\kantar\source\repos\Onclusive\Shared\test\Shared.Tests\DbContainer.cs:line 23
  --- End of stack trace from previous location ---
     at FluentAssertions.Specialized.AsyncFunctionAssertions`2.NotThrowAsync(String because, Object[] becauseArgs)
.

  Stack Trace: 
XUnit2TestFramework.Throw(String message)
TestFrameworkProvider.Throw(String message)
DefaultAssertionStrategy.HandleFailure(String message)
AssertionScope.FailWith(Func`1 failReasonFunc)
AssertionScope.FailWith(Func`1 failReasonFunc)
AssertionScope.FailWith(String message, Object[] args)
DelegateAssertionsBase`2.NotThrowInternal(Exception exception, String because, Object[] becauseArgs)
AsyncFunctionAssertions`2.NotThrowAsync(String because, Object[] becauseArgs)
DbContainerTest.Should_CreateDbContainer_When_ConfigurationIsValid() line 26
--- End of stack trace from previous location ---

To Reproduce
Steps to reproduce the behavior:

using DotNet.Testcontainers.Builders;
using DotNet.Testcontainers.Configurations;
using DotNet.Testcontainers.Containers;
using FluentAssertions;
using Xunit;

public class DbContainerTest
{
    [Fact]
    public async Task Should_CreateDbContainer_When_ConfigurationIsValid()
    {
        // Arrange
        var container = new TestcontainersBuilder<MySqlTestcontainer>()
            .WithDatabase(new MySqlTestcontainerConfiguration()
            {
                Database = "db",
                Username = "course",
                Password = "whatever"
            })
           .Build();

        // Act
        var action = async () => await container.StartAsync();

        // Assert
        await action.Should().NotThrowAsync();
    }
}

Desktop:

  • Version 4.13.0 (89412)
@HofmeisterAn
Copy link
Collaborator

HofmeisterAn commented Oct 24, 2022

I can confirm Docker.DotNet fail with Docker Desktop 4.13.0. I created dotnet/Docker.DotNet#595 and will start to take a look into it.

@HofmeisterAn HofmeisterAn added the bug Something isn't working label Oct 24, 2022
@HofmeisterAn HofmeisterAn added this to the 2.2.0 milestone Oct 24, 2022
@HofmeisterAn HofmeisterAn self-assigned this Oct 24, 2022
@HofmeisterAn
Copy link
Collaborator

I added a workaround until the upstream issue is identified and fixed. Anyone that relies on Docker Desktop 4.13.0 can use 2.2.0-beta.3311860540 or the upcoming 2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants