Bug 6167 - "number of users" value in load status is off by two
Summary: "number of users" value in load status is off by two
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VSM Agent (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.8.0
Assignee: Henrik Andersson
URL:
Keywords: relnotes, samuel_tester
Depends on:
Blocks:
 
Reported: 2017-02-09 17:59 CET by Karl Mikaelsson
Modified: 2017-03-20 17:09 CET (History)
3 users (show)

See Also:
Acceptance Criteria:


Attachments

Description Karl Mikaelsson cendio 2017-02-09 17:59:01 CET
Perhaps easiest described as two test cases:

>    @mock.patch("thinlinc.vsm.loadinfokeeper.subprocess_n_log")
>    def test_number_of_users_with_no_processes_in_ps_output(self, proc):
>        # Given
>        l = loadinfokeeper.LoadInfoKeeper(mock.MagicMock(name="parent"))
>        proc.side_effect = [(0, "  UID\n", "")]
>
>        # When
>        l.fetch_dynamic_loadinfo()
>
>        # Then
>        self.assertEqual(l.loadinfo['num_users'], 0)
>
>
>    @mock.patch("thinlinc.vsm.loadinfokeeper.subprocess_n_log")
>    def test_number_of_users_with_single_process_in_ps_output(self, proc):
>        # Given
>        l = loadinfokeeper.LoadInfoKeeper(mock.MagicMock(name="parent"))
>        proc.side_effect = [(0, "  UID\n1\n", "")]
>
>        # When
>        l.fetch_dynamic_loadinfo()
>
>        # Then
>        self.assertEqual(l.loadinfo['num_users'], 1)

Current results:

> ======================================================================
> FAIL: test_number_of_users_with_no_processes_in_ps_output (__main__.LoadInfoKeeperTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
>     return func(*args, **keywargs)
>   File "test_loadinfokeeper.py", line 66, in test_number_of_users_with_no_processes_in_ps_output
>     self.assertEqual(l.loadinfo['num_users'], 0)
> AssertionError: 2 != 0
>
> ======================================================================
> FAIL: test_number_of_users_with_single_process_in_ps_output (__main__.LoadInfoKeeperTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
>     return func(*args, **keywargs)
>   File "test_loadinfokeeper.py", line 80, in test_number_of_users_with_single_process_in_ps_output
>     self.assertEqual(l.loadinfo['num_users'], 1)
> AssertionError: 3 != 1
Comment 3 Samuel Mannehed cendio 2017-02-27 16:16:39 CET
Looks to be working very well. I verified that the problem existed on a 4.7.0 server and that it is fixed now with build 5383.

The new code is robust and I couldn't find any ways to break things.

Note You need to log in before you can comment on or make changes to this bug.