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); } }