Skip to content

Commit

Permalink
chore: Serialize object
Browse files Browse the repository at this point in the history
  • Loading branch information
HofmeisterAn committed Sep 20, 2024
1 parent f71be97 commit 2fb0018
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Task("Tests")
Filter = param.TestFilter,
ResultsDirectory = param.Paths.Directories.TestResultsDirectoryPath,
ArgumentCustomization = args => args
.AppendSwitchQuoted("--blame-hang-timeout", "5m")
});
});

Expand Down
6 changes: 3 additions & 3 deletions src/Testcontainers/Containers/DockerContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace DotNet.Testcontainers.Containers
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Docker.DotNet;
Expand Down Expand Up @@ -391,14 +392,13 @@ await _client.System.LogContainerRuntimeInfoAsync(ct)
Logger.ReusableExperimentalFeature();

var filters = new FilterByReuseHash(_configuration);

Logger.LogInformation("Hash={Hash}, Configuration={@Configuration}", _configuration.GetReuseHash(), _configuration);
Logger.LogInformation("Hash={Hash}, Configuration={Configuration}", _configuration.GetReuseHash(), JsonSerializer.Serialize(_configuration));

Check failure on line 395 in src/Testcontainers/Containers/DockerContainer.cs

View workflow job for this annotation

GitHub Actions / report (ubuntu-22.04)

Testcontainers.Tests.ReusableResourceTest ► ShouldReuseExistingResource

Failed test found in: Testcontainers.Platform.Linux.Tests.trx Error: System.NotSupportedException : Serialization and deserialization of 'System.Func`2[[Docker.DotNet.Models.ImageInspectResponse, Docker.DotNet, Version=3.125.0.0, Culture=neutral, PublicKeyToken=e628c633e2cf4146],[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' instances is not supported. The unsupported member type is located on type 'System.Func`2[Docker.DotNet.Models.ImageInspectResponse,System.Boolean]'. Path: $.ImagePullPolicy. ---- System.NotSupportedException : Serialization and deserialization of 'System.Func`2[[Docker.DotNet.Models.ImageInspectResponse, Docker.DotNet, Version=3.125.0.0, Culture=neutral, PublicKeyToken=e628c633e2cf4146],[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' instances is not supported.
Raw output
System.NotSupportedException : Serialization and deserialization of 'System.Func`2[[Docker.DotNet.Models.ImageInspectResponse, Docker.DotNet, Version=3.125.0.0, Culture=neutral, PublicKeyToken=e628c633e2cf4146],[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' instances is not supported. The unsupported member type is located on type 'System.Func`2[Docker.DotNet.Models.ImageInspectResponse,System.Boolean]'. Path: $.ImagePullPolicy.
---- System.NotSupportedException : Serialization and deserialization of 'System.Func`2[[Docker.DotNet.Models.ImageInspectResponse, Docker.DotNet, Version=3.125.0.0, Culture=neutral, PublicKeyToken=e628c633e2cf4146],[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' instances is not supported.
   at System.Text.Json.ThrowHelper.ThrowNotSupportedException(WriteStack& state, NotSupportedException ex)
   at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
   at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo`1 jsonTypeInfo)
   at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)
   at DotNet.Testcontainers.Containers.DockerContainer.UnsafeCreateAsync(CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 395
   at DotNet.Testcontainers.Containers.DockerContainer.StartAsync(CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 281
   at Testcontainers.Tests.ReusableResourceTest.InitializeAsync() in /home/runner/work/testcontainers-dotnet/testcontainers-dotnet/tests/Testcontainers.Platform.Linux.Tests/ReusableResourceTest.cs:line 44
----- Inner Stack Trace -----
   at System.Text.Json.Serialization.Converters.UnsupportedTypeConverter`1.Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)

var reusableContainers = await _client.Container.GetAllAsync(filters, ct)
.ConfigureAwait(false);

var reusableContainer = reusableContainers.SingleOrDefault();
Logger.LogInformation("ReusableContainer={@ReusableContainer}", reusableContainer);
Logger.LogInformation("ReusableContainer={ReusableContainer}", JsonSerializer.Serialize(reusableContainer));

if (reusableContainer != null)
{
Expand Down

0 comments on commit 2fb0018

Please sign in to comment.