Skip to content

Commit

Permalink
Add IntegrationTest_Timeout_Minutes to enable configurable timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
samdanaei committed Sep 25, 2024
1 parent 8e4a4e8 commit 8efcfbb
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public IntegrationTestTimeout(int timeoutInSeconds) : base((int)TimeSpan.FromSec
public IntegrationTestTimeout() : base(TestTimeoutInMilliseconds())
{
}



public static int TestTimeoutInMilliseconds()
{
Expand All @@ -21,7 +23,18 @@ public static int TestTimeoutInMilliseconds()
return (int)TimeSpan.FromHours(1).TotalMilliseconds;
}

return (int)TimeSpan.FromMinutes(10).TotalMilliseconds;
var timeoutFromEnvironmentVariable = GetTimeoutFromEnvironmentVariable();
return timeoutFromEnvironmentVariable ?? (int)TimeSpan.FromMinutes(10).TotalMilliseconds;
}

static int? GetTimeoutFromEnvironmentVariable()
{
if (int.TryParse(Environment.GetEnvironmentVariable("IntegrationTest_Timeout_Minutes"), out var timeoutFromEnv))
{
return (int)TimeSpan.FromMinutes(timeoutFromEnv).TotalMilliseconds;
}

return null;
}
}
}

0 comments on commit 8efcfbb

Please sign in to comment.