Skip to content

Commit c9b0602

Browse files
committed
time
1 parent 0de2f88 commit c9b0602

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

tests/ManagedCode.GraphRag.Tests/GraphRagApplicationFixture.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Runtime.InteropServices;
1+
using System.Globalization;
22
using DotNet.Testcontainers.Builders;
33
using DotNet.Testcontainers.Configurations;
44
using GraphRag;
@@ -21,7 +21,9 @@ public sealed class GraphRagApplicationFixture : IAsyncLifetime
2121
private const string Neo4jPassword = "test1234";
2222
private const string PostgresPassword = "postgres";
2323
private const string PostgresDatabase = "graphragdb";
24-
private static readonly TimeSpan ContainerStartupTimeout = TimeSpan.FromMinutes(10);
24+
private const string ContainerTimeoutEnvVar = "GRAPH_RAG_CONTAINER_TIMEOUT_MINUTES";
25+
private static readonly TimeSpan DefaultContainerStartupTimeout = TimeSpan.FromMinutes(30);
26+
private static readonly TimeSpan ContainerStartupTimeout = ResolveContainerStartupTimeout();
2527

2628
private ServiceProvider _serviceProvider = null!;
2729
private AsyncServiceScope? _scope;
@@ -165,6 +167,19 @@ private static string ConfigurePostgresConnection(string connectionString)
165167
return builder.ConnectionString;
166168
}
167169

170+
private static TimeSpan ResolveContainerStartupTimeout()
171+
{
172+
var envValue = Environment.GetEnvironmentVariable(ContainerTimeoutEnvVar);
173+
if (!string.IsNullOrWhiteSpace(envValue) &&
174+
double.TryParse(envValue, NumberStyles.Float, CultureInfo.InvariantCulture, out var minutes) &&
175+
minutes > 0)
176+
{
177+
return TimeSpan.FromMinutes(minutes);
178+
}
179+
180+
return DefaultContainerStartupTimeout;
181+
}
182+
168183
private async Task EnsurePostgresDatabaseAsync()
169184
{
170185
if (_postgresContainer is null)
@@ -247,11 +262,6 @@ private static bool IsJanusSupported()
247262
private static bool IsCosmosSupported()
248263
{
249264
var flag = Environment.GetEnvironmentVariable("GRAPH_RAG_ENABLE_COSMOS");
250-
if (string.Equals(flag, "true", StringComparison.OrdinalIgnoreCase))
251-
{
252-
return true;
253-
}
254-
255-
return RuntimeInformation.ProcessArchitecture == Architecture.X64;
265+
return string.Equals(flag, "true", StringComparison.OrdinalIgnoreCase);
256266
}
257267
}

0 commit comments

Comments
 (0)