Bug 15445

Summary: DateUtils.t fails on Jenkins due to server sluggishness
Product: Koha Reporter: Frédéric Demians <f.demians>
Component: Test SuiteAssignee: Frédéric Demians <f.demians>
Status: CLOSED FIXED QA Contact: Galen Charlton <gmcharlt>
Severity: trivial    
Priority: P5 - low CC: brendan, jonathan.druart, julian.maurice, tomascohen
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 15445 DateUtils.t fails on Jenkins due to server sluggishness
Bug 15445 DateUtils.t fails on Jenkins due to server sluggishness
Bug 15445 DateUtils.t fails on Jenkins due to server sluggishness

Description Frédéric Demians 2015-12-30 15:24:43 UTC
On Jenkins server two t/DateUtils.t test are failing with this message:

Failed test 'Create DateTime with dt_from_string() for 2100-01-01 with TZ in less than 1s'
at t/DateUtils.t line 82.
  '1.00921106338501'
      <
  '1'

It means that the server is abnormally slow to perform a task done in less than 1s elsewhere. The test would stay valid by giving just a bit more time to Jenkins server.
Comment 1 Frédéric Demians 2015-12-30 15:28:44 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2016-01-01 06:27:24 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2016-01-04 12:48:24 UTC
You are removing the usefulness of this test :)

This test should not take more than 1s, do you know if it's new?
Comment 4 Jonathan Druart 2016-01-04 12:51:12 UTC
A workaround would be to get the loadavg of the server at the moment the tests run.
If it's > x and the test fails, then skip it.
Comment 5 Frédéric Demians 2016-01-04 13:29:03 UTC
(In reply to Jonathan Druart from comment #3)
> You are removing the usefulness of this test :)

I don't. When this test is supposed to 'normally' fail it take minutes to calculate duration in the far futur (9999). So, changing the 'normal' duration from 1s to 4s doesn't change the ability of this test to detect the fix introduced by bug 13342 to the way Koha::DateUtils calculate 9999- dates. 

> This test should not take more than 1s, do you know if it's new?

No. It seems to occur randomly.
Comment 6 Jonathan Druart 2016-01-07 10:33:18 UTC
Tomas, do you know if the nodes are monitored?
It would be good to know if the server is overloaded when the test fails.
Comment 7 Tomás Cohen Arazi (tcohen) 2016-01-20 02:50:32 UTC
(In reply to Jonathan Druart from comment #6)
> Tomas, do you know if the nodes are monitored?
> It would be good to know if the server is overloaded when the test fails.

I'll try to gather some information.
Comment 8 Jonathan Druart 2016-03-08 12:06:20 UTC
Created attachment 48777 [details] [review]
Bug 15445 DateUtils.t fails on Jenkins due to server sluggishness

Jenkins server is abnormally slow to perform a task done in less than
1s elsewhere. The test stay valid by giving just a bit more time to Jenkins
server.

TO TEST:
- Confirm that the two test hasn't changed. They the just get 4s to
  perform
- Push the patch to master and observe that DateUtils.t doesn't fail
  anymore.

NOTE: Also passed koha qa test tools too.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended: Changed to 2s, should be enough
Comment 9 Jonathan Druart 2016-03-08 12:07:36 UTC
Frédéric, I have amended your patch and set the delay to 2sec.
It should be ok for jenkins.
Hope it's fine for you!
Comment 10 Brendan Gallagher 2016-03-08 21:56:08 UTC
Pushed to Master - Should be in the May 2016 Release.  Thanks
Comment 11 Julian Maurice 2016-03-14 09:55:31 UTC
Patch pushed to 3.22.x, will be in 3.22.5