Skip to content

Make sure testvalidateExpirationDateEnforceToFarIntoFuture unit test will fail if no exception is thrown - #34872

Merged
phil-davis merged 1 commit into
masterfrom
fix-testvalidateExpirationDateEnforceToFarIntoFuture-test
Jun 20, 2019
Merged

Make sure testvalidateExpirationDateEnforceToFarIntoFuture unit test will fail if no exception is thrown#34872
phil-davis merged 1 commit into
masterfrom
fix-testvalidateExpirationDateEnforceToFarIntoFuture-test

Conversation

@phil-davis

@phil-davis phil-davis commented Mar 22, 2019

Copy link
Copy Markdown
Contributor

Description

Add a fail in the test path that should not happen. The test is expected to throw an exception, and the catch block get executed. The fail at the end of the try block ensures that if the expected exception is not thrown, then the test will fail.

Note: the test does go down the correct catch block at present, so the test itself does not need changing. I thought that some time in the past the exception was not being thrown, but maybe I was wrong.

Related Issue

#34874

Motivation and Context

Remove the possibility of snake-oil tests.

How Has This Been Tested?

  • local unit test run and CI
  • change the expected status from 404 to 403 and see that the test fails, thus confirming that the code in the catch block is really being executed.
  • adjust the test case data so that no exception is thrown. See that the new fail() message happens and the test fails.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

@phil-davis phil-davis self-assigned this Mar 22, 2019
@phil-davis
phil-davis force-pushed the fix-testvalidateExpirationDateEnforceToFarIntoFuture-test branch from e86eb62 to a4acde5 Compare April 3, 2019 08:11
@codecov

codecov Bot commented Apr 3, 2019

Copy link
Copy Markdown

Codecov Report

Merging #34872 into master will decrease coverage by 16.98%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #34872       +/-   ##
=============================================
- Coverage     65.38%   48.39%   -16.99%     
=============================================
  Files          1213      109     -1104     
  Lines         70408    10493    -59915     
  Branches       1295     1280       -15     
=============================================
- Hits          46035     5078    -40957     
+ Misses        23999     5043    -18956     
+ Partials        374      372        -2
Flag Coverage Δ Complexity Δ
#javascript 53.04% <ø> (+0.19%) 0 <ø> (ø) ⬇️
#phpunit 38.17% <ø> (-28.66%) 0 <ø> (-18592)
Impacted Files Coverage Δ Complexity Δ
lib/private/Files/Storage/DAV.php 59.45% <0%> (-21.64%) 0% <0%> (ø)
apps/updatenotification/templates/admin.php
lib/private/Encryption/Keys/Storage.php
lib/private/App/CodeChecker/NodeVisitor.php
lib/private/RedisFactory.php
apps/dav/lib/Avatars/AvatarNode.php
...s/dav/appinfo/Migrations/Version20170202213905.php
apps/dav/lib/Upload/ChunkLocationProvider.php
apps/files/lib/AppInfo/Application.php
apps/systemtags/list.php
... and 1098 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f1fc5b0...a4acde5. Read the comment docs.

@codecov

codecov Bot commented Apr 3, 2019

Copy link
Copy Markdown

Codecov Report

Merging #34872 into master will increase coverage by 0.3%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##             master   #34872     +/-   ##
===========================================
+ Coverage     65.37%   65.68%   +0.3%     
  Complexity    18775    18775             
===========================================
  Files          1222     1222             
  Lines         70898    70932     +34     
  Branches       1289     1289             
===========================================
+ Hits          46353    46594    +241     
+ Misses        24167    23960    -207     
  Partials        378      378
Flag Coverage Δ Complexity Δ
#javascript 53.7% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 67.05% <ø> (+0.34%) 18775 <ø> (ø) ⬇️
Impacted Files Coverage Δ Complexity Δ
lib/private/Files/Cache/HomePropagator.php 77.77% <0%> (-9.73%) 3% <0%> (ø)
apps/files/lib/Command/Scan.php 71.91% <0%> (-9.17%) 74% <0%> (ø)
apps/dav/lib/Connector/Sabre/File.php 84.19% <0%> (+0.64%) 115% <0%> (ø) ⬇️
lib/private/Files/Mount/MountPoint.php 93.5% <0%> (+1.29%) 34% <0%> (ø) ⬇️
lib/private/legacy/util.php 68.19% <0%> (+2.55%) 240% <0%> (ø) ⬇️
apps/files_versions/lib/Storage.php 72.67% <0%> (+2.81%) 95% <0%> (ø) ⬇️
lib/private/Files/Storage/Common.php 85.15% <0%> (+3.33%) 141% <0%> (ø) ⬇️
apps/files_trashbin/lib/Quota.php 92% <0%> (+4%) 9% <0%> (ø) ⬇️
lib/private/Files/Type/Detection.php 74.56% <0%> (+4.38%) 52% <0%> (ø) ⬇️
lib/private/Files/Cache/Storage.php 80.45% <0%> (+4.59%) 32% <0%> (ø) ⬇️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 192501e...f88fb63. Read the comment docs.

@micbar

micbar commented Jun 7, 2019

Copy link
Copy Markdown
Contributor

@phil-davis Do you need some help on this?

@phil-davis

Copy link
Copy Markdown
Contributor Author

@micbar I will look tomorrow.
I got side-tracked last week with "random" problems in webUI testing due to chrome 75 release.

@phil-davis
phil-davis force-pushed the fix-testvalidateExpirationDateEnforceToFarIntoFuture-test branch 2 times, most recently from 558b3a1 to 7dd30a2 Compare June 17, 2019 06:01
@phil-davis

Copy link
Copy Markdown
Contributor Author

Backport stable10 #35611

@phil-davis
phil-davis merged commit ed9c8f9 into master Jun 20, 2019
@delete-merged-branch
delete-merged-branch Bot deleted the fix-testvalidateExpirationDateEnforceToFarIntoFuture-test branch June 20, 2019 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants