Пример #1
0
            public void GuardDoesNotKeepTheContainerJobObjectOpen()
            {
                Container1.StartGuard();


                var username = ContainerUsername(Container1);
                var userPids = UserPids(username);
            }
Пример #2
0
            public void PutsEscapedUserProcessesBackIntoJobObject()
            {
                Container1.StartGuard();

                // ping.exe is a Console app. Windows will start a conhost for ping.exe which
                // is by default outside job objects. We want to assert that all processes
                // including conhost is added back to the JobObject.
                var username = ContainerUsername(Container1);

                var userPids  = UserPids(username);
                var pidsInJob = new List <int>();
                var sw        = Stopwatch.StartNew();

                while (userPids.Count != pidsInJob.Count && sw.ElapsedMilliseconds < 1000)
                {
                    pidsInJob = new JobObject(Container1.Id).GetProcessIds().ToList();
                }
                pidsInJob.Sort();

                Assert.Equal(userPids, pidsInJob);
            }