Beispiel #1
0
        public void Verify_probe_na()
        {
            var knowledgeBaseProvider = _provider.GetService <IKnowledgeBaseProvider>();
            var probe = new FileDescriptorThrottlingProbe(null, knowledgeBaseProvider);

            OperatingSystemSnapshot snapshot = new FakeOperatingSystemSnapshot1(100, 60);

            var result = probe.Execute(snapshot);

            result.Status.ShouldBe(ProbeResultStatus.NA);
        }
Beispiel #2
0
        public void Verify_probe_na()
        {
            var knowledgeBaseProvider = _services.GetService <IKnowledgeBaseProvider>();
            var probe = new FileDescriptorThrottlingProbe(null, knowledgeBaseProvider);

            OperatingSystemSnapshot snapshot = new () { FileDescriptors = new () { Available = 100, Used = 60 } };

            var result = probe.Execute(snapshot);

            Assert.AreEqual(ProbeResultStatus.NA, result.Status);
        }
    }
Beispiel #3
0
        public void Verify_probe_healthy_condition()
        {
            var knowledgeBaseProvider = _provider.GetService <IKnowledgeBaseProvider>();
            var config = _provider.GetService <HareDuConfig>();
            var probe  = new FileDescriptorThrottlingProbe(config.Diagnostics, knowledgeBaseProvider);

            OperatingSystemSnapshot snapshot = new FakeOperatingSystemSnapshot1(100, 60);

            var result = probe.Execute(snapshot);

            result.Status.ShouldBe(ProbeResultStatus.Healthy);
            result.KB.Id.ShouldBe(typeof(FileDescriptorThrottlingProbe).GetIdentifier());
        }
Beispiel #4
0
        public void Verify_probe_healthy_condition()
        {
            HareDuConfig config = new () { Diagnostics = new () { Probes = new () { FileDescriptorUsageThresholdCoefficient = 0.65M } } };
            var          knowledgeBaseProvider = _services.GetService <IKnowledgeBaseProvider>();
            var          probe = new FileDescriptorThrottlingProbe(config.Diagnostics, knowledgeBaseProvider);

            OperatingSystemSnapshot snapshot = new () { FileDescriptors = new () { Available = 100, Used = 60 } };

            var result = probe.Execute(snapshot);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(ProbeResultStatus.Healthy, result.Status);
                Assert.AreEqual(typeof(FileDescriptorThrottlingProbe).GetIdentifier(), result.KB.Id);
            });
        }

        [Test]