public void Verify_empty_result_returned_when_snapshot_null() { ClusterSnapshot snapshot = null; var result = new ClusterScanner(_probes) .Scan(snapshot); result.ShouldBeEmpty(); }
public void Verify_empty_result_returned_when_snapshot_null() { ClusterSnapshot snapshot = null; var result = new ClusterScanner(_probes) .Scan(snapshot); Assert.IsEmpty(result); }
public void Verify_analyzers_fired() { ClusterSnapshot snapshot = new FakeClusterSnapshot1(); var result = new ClusterScanner(_probes) .Scan(snapshot); result.Count.ShouldBe(7); result.Count(x => x.Id == typeof(RuntimeProcessLimitProbe).GetIdentifier()).ShouldBe(1); result.Count(x => x.Id == typeof(SocketDescriptorThrottlingProbe).GetIdentifier()).ShouldBe(1); result.Count(x => x.Id == typeof(NetworkPartitionProbe).GetIdentifier()).ShouldBe(1); result.Count(x => x.Id == typeof(MemoryAlarmProbe).GetIdentifier()).ShouldBe(1); result.Count(x => x.Id == typeof(DiskAlarmProbe).GetIdentifier()).ShouldBe(1); result.Count(x => x.Id == typeof(AvailableCpuCoresProbe).GetIdentifier()).ShouldBe(1); result.Count(x => x.Id == typeof(FileDescriptorThrottlingProbe).GetIdentifier()).ShouldBe(1); }
public void Verify_analyzers_fired() { ClusterSnapshot snapshot = new () { Nodes = new List <NodeSnapshot> { new () { NetworkPartitions = new List <string> { "node1@rabbitmq", "node2@rabbitmq", "node3@rabbitmq" }, Runtime = new() { Processes = new() { Limit = 38, Used = 36, UsageRate = 5.3M } }, Disk = new() { AlarmInEffect = true, Capacity = new() { Available = 8, Rate = 5.5M } }, Memory = new() { Used = 273, Limit = 270, AlarmInEffect = true }, OS = new() { FileDescriptors = new() { Available = 100, Used = 90, UsageRate = 5.5M }, SocketDescriptors = new() { Available = 100, Used = 90, UsageRate = 5.5M } }, AvailableCoresDetected = 1 } } }; var result = new ClusterScanner(_probes) .Scan(snapshot); Assert.Multiple(() => { Assert.AreEqual(7, result.Count); Assert.AreEqual(1, result.Count(x => x.Id == typeof(RuntimeProcessLimitProbe).GetIdentifier())); Assert.AreEqual(1, result.Count(x => x.Id == typeof(SocketDescriptorThrottlingProbe).GetIdentifier())); Assert.AreEqual(1, result.Count(x => x.Id == typeof(NetworkPartitionProbe).GetIdentifier())); Assert.AreEqual(1, result.Count(x => x.Id == typeof(MemoryAlarmProbe).GetIdentifier())); Assert.AreEqual(1, result.Count(x => x.Id == typeof(DiskAlarmProbe).GetIdentifier())); Assert.AreEqual(1, result.Count(x => x.Id == typeof(AvailableCpuCoresProbe).GetIdentifier())); Assert.AreEqual(1, result.Count(x => x.Id == typeof(FileDescriptorThrottlingProbe).GetIdentifier())); }); }