You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get the following error when my tests are run in GitLab:
Error Message:
[Test Collection Cleanup Failure (PostgresSqlContainerCollection)]: System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at Common.TestUtils.PostgresSqlContainerFixture.DisposeAsync() in Common.TestUtils/PostgresSqlContainerFixture.cs:line 17
Our current GitLab setting causes tests which use Docker to fail, so I temporarily skip all the tests which use Test Containers.
Here's the code of the fixture:
public sealed class PostgresSqlContainerFixture : IAsyncLifetime
{
private static readonly PostgreSqlBuilder Builder = new();
public PostgreSqlContainer Container { get; private set; } = null!;
public async Task DisposeAsync()
{
await Container.StopAsync();
}
public async Task InitializeAsync()
{
Container = Builder.Build();
await Container.StartAsync();
}
}
I cannot find an exception coming from InitializeAsync in GitLab log, but I assume it is called, and exception is swallowed/ignored.
Maybe it's not called at all. I do not know for sure.
I changed InitializeAsync to
public async Task InitializeAsync()
{
throw new Exception();
}
And I started seeing these errors when run tests locally:
Failed Given user is NOT a member of current organization when checking this fact then returns false [1 ms]
Error Message:
System.Exception : Exception of type 'System.Exception' was thrown.
Stack Trace:
at Common.TestUtils.PostgresSqlContainerFixture.InitializeAsync() in Common.TestUtils\PostgresSqlContainerFixture.cs:line 18
Failed Given user is NOT a member of current organization when checking this fact then returns false [1 ms]
Error Message:
[Test Collection Cleanup Failure (PostgresSqlContainerCollection)]: System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at Common.TestUtils.PostgresSqlContainerFixture.DisposeAsync() in Common.TestUtils\PostgresSqlContainerFixture.cs:line 13
Hey @voroninp, you might be interested in testing the new (unreleased yet) Testcontainers.Xunit package. It should handle container not starting properly. See testcontainers/testcontainers-dotnet#1165, you'll need to checkout my feature/Testcontainers.Xunit branch and add Testcontainers.Xunit as a project reference if you want to experiment with it.
I get the following error when my tests are run in GitLab:
Our current GitLab setting causes tests which use Docker to fail, so I temporarily skip all the tests which use Test Containers.
Here's the code of the fixture:
I cannot find an exception coming from
InitializeAsync
in GitLab log, but I assume it is called, and exception is swallowed/ignored.Maybe it's not called at all. I do not know for sure.
I changed
InitializeAsync
toAnd I started seeing these errors when run tests locally:
However, my project to reproduce the issue does not indicate
InitializeAsync
gets called at all:So what we have:
It's either only
DisposeAsync
being always called, or bothInitializeAsync
andDisposeAsync
being called and both failing.The text was updated successfully, but these errors were encountered: