forked from mtusi2026/mtusi2026lab5
Реализация 5 лабораторной работы
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace Messenger.Api.Jobs;
|
||||
|
||||
internal static class JobFaultInjection
|
||||
{
|
||||
public static void At(string stage, Guid attachmentId, int? attempt = null)
|
||||
{
|
||||
var target = attempt is null ? $"{stage}:{attachmentId:D}" : $"{stage}:{attachmentId:D}:{attempt}";
|
||||
if (Environment.GetEnvironmentVariable("LAB5_TEST_FAULT") != target) return;
|
||||
Console.Error.WriteLine($"Injected fault {stage} for {attachmentId:D}");
|
||||
if (stage == "transient") throw new IOException("Injected storage error");
|
||||
Environment.Exit(71);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user