thewca / worldcubeassociation.org

All of the code that runs on worldcubeassociation.org
https://www.worldcubeassociation.org/
GNU General Public License v3.0
326 stars 175 forks source link

Test failure on some random generated emails #4938

Open viroulep opened 4 years ago

viroulep commented 4 years ago

This popped up in one of travis' builds:

ActiveRecord::ValueTooLong:
       Mysql2::Error: Data too long for column 'submitterEmail' at row 1: INSERT INTO `CompetitionsMedia` (`competitionId`, `type`, `text`, `uri`, `submitterName`, `submitterComment`, `submitterEmail`, `timestampSubmitted`, `status`) VALUES ('FooComp6252015', 'article', 'i am from 2013 and accepted', 'https://www.example.com/article-42', 'Denis Christiansen', 'This is a comment', 'florance_mclaughlin@schambergerchristiansen.com', '2019-12-07 07:43:32', 'accepted')

We should look into FactoryBot's settings to have emails below a given threshold, but most importantly we should fail registration for users with emails above what our db supports!

viroulep commented 4 years ago

Oh and the test failed is:

rspec ./spec/requests/media_spec.rb[1:6:1:1:1] # media PATCH #update it should behave like only WCT when not signed in redirects to sign in page
tussosedan commented 4 years ago

It looks like our DB isn't consistent in the various emails column data types, is there a reason for it?

image

SELECT 
    TABLE_NAME, COLUMN_NAME, data_type, CHARACTER_MAXIMUM_LENGTH
FROM
    INFORMATION_SCHEMA.COLUMNS
WHERE
    COLUMN_NAME LIKE '%email%'
        AND TABLE_SCHEMA = 'wca_development'
        AND column_name NOT LIKE 'receive%'
        AND column_name NOT LIKE '%allow%'
        AND column_name NOT LIKE '%hash%'
        AND column_name NOT LIKE '%time%'
ORDER BY 1 , 2;
viroulep commented 4 years ago

Just came across your reply and no, there is no particular reason for it. While I can't tell for competitionsmedia and the archive stuff, the last 4 tables definitely should all have the same limit!

tussosedan commented 4 years ago

Hmm we should probably align them at some point.