cs-codex-dist-tests/Framework/Core/TimeSet.cs

89 lines
2.2 KiB
C#
Raw Normal View History

2023-09-12 11:32:06 +00:00
namespace Core
2023-04-12 14:06:04 +00:00
{
public interface ITimeSet
{
/// <summary>
/// Timeout for a single HTTP call.
/// </summary>
2023-04-12 14:06:04 +00:00
TimeSpan HttpCallTimeout();
/// <summary>
/// Maximum total time to attempt to make a successful HTTP call to a service.
/// When HTTP calls time out during this timespan, retries will be made.
/// </summary>
TimeSpan HttpRetryTimeout();
/// <summary>
/// After a failed HTTP call, wait this long before trying again.
/// </summary>
TimeSpan HttpCallRetryDelay();
/// <summary>
/// After a failed K8s operation, wait this long before trying again.
/// </summary>
TimeSpan K8sOperationRetryDelay();
/// <summary>
/// Maximum total time to attempt to perform a successful k8s operation.
/// If k8s operations fail during this timespan, retries will be made.
/// </summary>
2023-04-12 14:06:04 +00:00
TimeSpan K8sOperationTimeout();
}
public class DefaultTimeSet : ITimeSet
{
public TimeSpan HttpCallTimeout()
{
return TimeSpan.FromMinutes(3);
2023-04-12 14:06:04 +00:00
}
public TimeSpan HttpRetryTimeout()
2023-04-12 14:06:04 +00:00
{
return TimeSpan.FromMinutes(10);
2023-04-12 14:06:04 +00:00
}
public TimeSpan HttpCallRetryDelay()
2023-04-12 14:06:04 +00:00
{
2023-06-08 11:23:26 +00:00
return TimeSpan.FromSeconds(1);
2023-04-12 14:06:04 +00:00
}
public TimeSpan K8sOperationRetryDelay()
2023-04-12 14:06:04 +00:00
{
return TimeSpan.FromSeconds(10);
2023-04-12 14:06:04 +00:00
}
public TimeSpan K8sOperationTimeout()
{
return TimeSpan.FromMinutes(30);
2023-04-12 14:06:04 +00:00
}
}
public class LongTimeSet : ITimeSet
{
public TimeSpan HttpCallTimeout()
{
return TimeSpan.FromMinutes(30);
}
public TimeSpan HttpRetryTimeout()
{
return TimeSpan.FromHours(2.2);
}
public TimeSpan HttpCallRetryDelay()
{
return TimeSpan.FromSeconds(20);
}
public TimeSpan K8sOperationRetryDelay()
{
return TimeSpan.FromSeconds(30);
}
public TimeSpan K8sOperationTimeout()
{
return TimeSpan.FromHours(1);
}
}
2023-04-12 14:06:04 +00:00
}