public void TestCGroupContentWithInvalidData() { if (!File.Exists("/proc/self/cgroup")) { return; //only run in Docker - this check can be improved } var noopLogger = new NoopLogger(); var systemInfoHelper = new TestSystemInfoHelper(noopLogger, "asdf:invalid-dockerid:243543"); var systemInfo = systemInfoHelper.ParseSystemInfo(); systemInfo.Container.Should().BeNull(); }
public void TestCGroupContent(string cGroupContent, string expectedContainerId) { if (!File.Exists("/proc/self/cgroup")) { return; //only run in Docker - this check can be improved } var noopLogger = new NoopLogger(); var systemInfoHelper = new TestSystemInfoHelper(noopLogger, cGroupContent); var systemInfo = systemInfoHelper.ParseSystemInfo(); systemInfo.Should().NotBeNull(); systemInfo.Container.Should().NotBeNull(); systemInfo.Container.Id.Should().Be(expectedContainerId); }
public void TestCGroupContentWithInvalidData() { if (!File.Exists("/proc/self/cgroup")) { return; //only run in Docker - this check can be improved } var noopLogger = new NoopLogger(); var systemInfoHelper = new TestSystemInfoHelper(noopLogger, "asdf:invalid-dockerid:243543"); var systemInfo = systemInfoHelper.ReadContainerId(noopLogger); //The current implementation returns null instead of an empty System instance. //This may changes later, the point of the test is to make sure there is no container id systemInfo.Should().BeNull(); }