Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Travis play nice #138

Open
Rumperuu opened this issue Aug 26, 2020 · 4 comments · May be fixed by #140
Open

Make Travis play nice #138

Rumperuu opened this issue Aug 26, 2020 · 4 comments · May be fixed by #140
Assignees
Labels
Milestone

Comments

@Rumperuu
Copy link

Rumperuu commented Aug 26, 2020

Having branched off of development and made some changes to README.md, attempting to merge (PR #135) those changes back with development has been rejected by Travis.

@Rumperuu Rumperuu added this to To do in LocalSpend Server via automation Aug 26, 2020
@Rumperuu Rumperuu added this to the Beta Release milestone Aug 26, 2020
@Rumperuu Rumperuu linked a pull request Aug 26, 2020 that will close this issue
@Rumperuu
Copy link
Author

rumperuu@ben-desktop:LocalSpend Server$ prove -lr
./t/admin/login.t ...................... ok    
./t/admin/organisation.t ............... ok    
./t/admin/reports/transactions.t ....... ok    
./t/admin/transaction.t ................ ok    
./t/admin/user.t ....................... ok    
./t/api/categories.t ................... ok   
./t/api/feedback.t ..................... 1/? 
#   Failed test '400 Bad Request'
#   at ./t/api/feedback.t line 77.
#          got: '200'
#     expected: '400'
# HTTP/1.1 200 OK
# Access-Control-Allow-Headers: Content-Type, X-CSRF-Token
# Access-Control-Allow-Methods: GET, OPTIONS, POST, DELETE, PUT
# Content-Length: 57
# Access-Control-Allow-Origin: *
# Access-Control-Allow-Credentials: true
# Server: Mojolicious (Perl)
# Access-Control-Max-Age: 1728000
# Content-Type: application/json;charset=UTF-8
# Date: Sun, 18 Oct 2020 12:48:07 GMT
# 
# {"message":"Thank you for your Feedback!","success":true}

#   Failed test 'exact match for JSON Pointer "/success"'
#   at ./t/api/feedback.t line 77.
#          got: '1'
#     expected: '0'

#   Failed test 'similar match for JSON Pointer "/message"'
#   at ./t/api/feedback.t line 77.
#                   'Thank you for your Feedback!'
#     doesn't match '(?^u:Feedback is required)'
# Looks like you failed 3 tests of 43.
./t/api/feedback.t ..................... Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/43 subtests 
./t/api/login.t ........................ ok    
./t/api/organisation.t ................. ok    
./t/api/register.t ..................... 1/? 
#   Failed test '400 Bad Request'
#   at ./t/api/register.t line 103.
#          got: '200'
#     expected: '400'

#   Failed test 'exact match for JSON Pointer "/success"'
#   at ./t/api/register.t line 103.
#          got: '1'
#     expected: '0'

#   Failed test 'content is similar'
#   at ./t/api/register.t line 103.
#                   '{"message":"Registered Successfully","success":true}'
#     doesn't match '(?^ui:blank)'

#   Failed test 'content is similar'
#   at ./t/api/register.t line 103.
#                   '{"message":"Registered Successfully","success":true}'
#     doesn't match '(?^ui:name)'

#   Failed test '400 Bad Request'
#   at ./t/api/register.t line 119.
#          got: '403'
#     expected: '400'

#   Failed test 'content is similar'
#   at ./t/api/register.t line 119.
#                   '{"error":"not_in_resultset","message":"Email already in use.","success":false}'
#     doesn't match '(?^ui:blank)'

#   Failed test 'content is similar'
#   at ./t/api/register.t line 119.
#                   '{"error":"not_in_resultset","message":"Email already in use.","success":false}'
#     doesn't match '(?^ui:name)'

#   Failed test '200 OK'
#   at ./t/api/register.t line 137.
#          got: '403'
#     expected: '200'

#   Failed test 'exact match for JSON Pointer "/success"'
#   at ./t/api/register.t line 137.
#          got: '0'
#     expected: '1'
# Looks like you failed 9 tests of 97.
./t/api/register.t ..................... Dubious, test returned 9 (wstat 2304, 0x900)
Failed 9/97 subtests 
./t/api/register/location.t ............ ok    
./t/api/search.t ....................... ok     
./t/api/stats.t ........................ ok   
./t/api/stats_leaderboards.t ........... ok    
./t/api/transactions.t ................. ok    
./t/api/upload.t ....................... ok     
./t/api/upload/distance.t .............. ok   
./t/api/user.t ......................... ok    
./t/api/user/postcode.t ................ ok    
./t/api/v1/customer/graphs.t ........... ok    
./t/api/v1/customer/pies.t ............. ok   
./t/api/v1/customer/snippets.t ......... ok    
./t/api/v1/organisation/graphs.t ....... ok    
./t/api/v1/organisation/snippets.t ..... ok    
./t/api/v1/supplier/location.t ......... ok    
./t/api/v1/supplier/location_errors.t .. ok    
./t/basic.t ............................ ok   
./t/plugins/validators.t ............... ok   
./t/schema/leaderboard.t ............... ok    
./t/schema/leaderboard_trend.t ......... ok    
./t/schema/resultset_leaderboard.t ..... ok    

Test Summary Report
-------------------
./t/api/feedback.t                   (Wstat: 768 Tests: 43 Failed: 3)
  Failed tests:  22-24
  Non-zero exit status: 3
./t/api/register.t                   (Wstat: 2304 Tests: 97 Failed: 9)
  Failed tests:  25-28, 30, 32-33, 35-36
  Non-zero exit status: 9
Files=31, Tests=899, 74 wallclock secs ( 0.29 usr  0.08 sys + 63.06 cusr  4.23 csys = 67.66 CPU)
Result: FAIL

@Rumperuu
Copy link
Author

The failing tests are all the same: things are succeeding with blank fields when they should be failing.

Looking at feedback.t though, there are two such tests: the test for a blank email address (lines 17–28); and the test for a blank feedback submission (lines 77–87). However, the first test passes despite looking identical to the second, which fails.

In LocalLoop/Controller/Api/Feedback.pm, both look like they're getting validated the same way.

Looking at Scheme/Result/Feedback.pm, there is no column for ‘email’ in the __PACKAGE__->add_columns() call, so maybe it's that?

@Rumperuu
Copy link
Author

Re: feedback, ‘email’ is only used to find a user (rather than being actually submitted to the database). So my thinking is that the other tests are failing because the validation fails to realise that blank strings are invalid.

@Rumperuu
Copy link
Author

Rumperuu commented Oct 18, 2020

Solved! The not_empty filter was missing (https://docs.mojolicious.org/Mojolicious/Validator#not_empty) so I've added it onto those fields for which tests exist.

@Rumperuu Rumperuu linked a pull request Nov 18, 2020 that will close this issue
@Rumperuu Rumperuu added the bug label Jan 5, 2021
@Rumperuu Rumperuu linked a pull request Mar 20, 2021 that will close this issue
@Rumperuu Rumperuu linked a pull request Mar 20, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment