Ejemplo n.º 1
0
 public async Task DMPendingMultiple_RMNone()
 {
     await RunCommonTestAsync(
         new TestRepairRecord[]
     {
         TestRepairRecord.CreateActive("machine1", "SoftReboot"),
         TestRepairRecord.CreateActive("machine2", "HardReboot"),
         TestRepairRecord.CreateActive("machine3", "SwitchService"),
         TestRepairRecord.CreateActive("machine4", "Reassign"),
         TestRepairRecord.CreatePending("machine1", "SoftReboot", TimeSpan.FromHours(72)),
         TestRepairRecord.CreatePending("machine2", "HardReboot", TimeSpan.FromHours(72)),
         TestRepairRecord.CreatePending("machine3", "SwitchService", TimeSpan.FromHours(72)),
         TestRepairRecord.CreatePending("machine4", "Reassign", TimeSpan.FromHours(72)),
     },
         new IRepairTask[]
     {
     },
         new string[]
     {
         "CreateRepairTaskInPreparing:MACHINE1/SoftReboot:Restart:False",
         "CreateRepairTaskInPreparing:MACHINE2/HardReboot:Restart:False",
         "CreateRepairTaskInPreparing:MACHINE3/SwitchService:Restart:False",
         "CreateRepairTaskInPreparing:MACHINE4/Reassign:RemoveData:False",
     });
 }
Ejemplo n.º 2
0
 public async Task DMPending_RMNone()
 {
     await RunCommonTestAsync(
         new TestRepairRecord[]
     {
         TestRepairRecord.CreatePending("machine1", "SoftReboot", TimeSpan.FromHours(72)),
     },
         new IRepairTask[]
     {
     },
         new string[]
     {
         "CreateRepairTaskInPreparing:MACHINE1/SoftReboot:Restart:False",
     });
 }
Ejemplo n.º 3
0
 public async Task DMPending_RMExecuting_NegativeDMDelay()
 {
     await RunCommonTestAsync(
         new TestRepairRecord[]
     {
         TestRepairRecord.CreatePending("machine1", "SoftReboot", TimeSpan.FromMinutes(-5)),
     },
         new IRepairTask[]
     {
         new MockRepairTask("AP/MACHINE1/SoftReboot/20170401-030813", "SoftReboot")
         {
             State = RepairTaskState.Executing,
         },
     },
         new string[]
     {
     });
 }
Ejemplo n.º 4
0
 public async Task DMPending_RMApprovedRecently()
 {
     await RunCommonTestAsync(
         new TestRepairRecord[]
     {
         TestRepairRecord.CreatePending("machine1", "SoftReboot", TimeSpan.FromHours(72)),
     },
         new IRepairTask[]
     {
         new MockRepairTask("AP/MACHINE1/SoftReboot/20170401-030813", "SoftReboot")
         {
             State             = RepairTaskState.Approved,
             ApprovedTimestamp = DateTime.UtcNow,
         },
     },
         new string[]
     {
     });
 }
Ejemplo n.º 5
0
 public async Task DMPending_RMCompleted()
 {
     await RunCommonTestAsync(
         new TestRepairRecord[]
     {
         TestRepairRecord.CreatePending("machine1", "SoftReboot", TimeSpan.FromHours(72)),
     },
         new IRepairTask[]
     {
         new MockRepairTask("AP/MACHINE1/SoftReboot/20170401-030813", "SoftReboot")
         {
             State = RepairTaskState.Completed,
         },
     },
         new string[]
     {
         "CreateRepairTaskInPreparing:MACHINE1/SoftReboot:Restart:False",
     });
 }
Ejemplo n.º 6
0
        public async Task DMPending_RMPreparing_Overdue()
        {
            await RunCommonTestAsync(
                new TestRepairRecord[]
            {
                TestRepairRecord.CreatePending("machine1", "SoftReboot", TimeSpan.FromHours(72)),
            },
                new IRepairTask[]
            {
                new MockRepairTask("AP/MACHINE1/SoftReboot/20170401-030813", "SoftReboot")
                {
                    State = RepairTaskState.Preparing,
                    PreparingTimestamp = DateTime.UtcNow.AddMinutes(-500),
                },
            },
                new string[]
            {
            });

            Assert.AreEqual(1, this.context.OverdueRepairTaskCount);
        }
Ejemplo n.º 7
0
 public async Task DMPending_RMExecuting_DoNotIncreaseDelayWhenApproved()
 {
     await RunCommonTestAsync(
         new TestRepairRecord[]
     {
         TestRepairRecord.CreatePending(
             "machine1", "SoftReboot", TimeSpan.FromMinutes(1),
             isApproved: true,
             isDelayModified: false),     // because delay is already short
     },
         new IRepairTask[]
     {
         new MockRepairTask("AP/MACHINE1/SoftReboot/20170401-030813", "SoftReboot")
         {
             State = RepairTaskState.Executing,
         },
     },
         new string[]
     {
         "ExecuteRepair:MACHINE1/SoftReboot:AP/MACHINE1/SoftReboot/20170401-030813",
     });
 }
Ejemplo n.º 8
0
 public async Task DMPending_RMExecuting()
 {
     await RunCommonTestAsync(
         new TestRepairRecord[]
     {
         TestRepairRecord.CreatePending(
             "machine1", "SoftReboot", TimeSpan.FromHours(72),
             isApproved: true,
             isDelayModified: true),
     },
         new IRepairTask[]
     {
         new MockRepairTask("AP/MACHINE1/SoftReboot/20170401-030813", "SoftReboot")
         {
             State = RepairTaskState.Executing,
         },
     },
         new string[]
     {
         "ExecuteRepair:MACHINE1/SoftReboot:AP/MACHINE1/SoftReboot/20170401-030813",
     });
 }