Commit Graph

203 Commits

Author SHA1 Message Date
Eugene Kenny
ee525ff663 Load framework test files in deterministic order
`Dir.glob` doesn't guarantee the order of its results:

https://ruby-doc.org/core-2.6.5/Dir.html#method-c-glob

> Case sensitivity depends on your system (File::FNM_CASEFOLD is
> ignored), as does the order in which the results are returned.

Minitest stores a list of all test cases in the order that they were
defined; it shuffles them before they're run, but doesn't sort them:

https://github.com/seattlerb/minitest/blob/v5.13.0/lib/minitest.rb#L1048
https://github.com/seattlerb/minitest/blob/v5.13.0/lib/minitest.rb#L156

This means that the order in which framework tests run is platform
dependent, and running a test command that failed in CI locally won't
necessarily reproduce the error, even when the same seed is provided.

`Rake::FileList` resolves glob patterns to a sorted list of files:

https://github.com/ruby/rake/blob/v13.0.1/lib/rake/file_list.rb#L408

By using `Rake::FileList` instead of `Dir.glob`, framework tests will
always run in the same order when given the same seed, and reproducing
order dependent CI failures will be easier.
2019-12-16 16:55:06 +00:00
Matthew Draper
99d84c6ab2 Clean up AR's isolated test runner 2019-03-05 02:02:41 +10:30
Matthew Draper
af986325e9 Copy the forking isolated test runner from railties
All the tests have a substantial chunk of identical setup effort (in
cases/helper.rb); this makes isolated tests run much faster, without any
change to the variety of how we load files.
2019-03-05 01:42:44 +10:30
Matthew Draper
7724a6e98b Support running AR isolated tests in parallel 2019-02-13 23:58:55 +10:30
Matthew Draper
287920ca7d Respect ENV variables when finding DBs etc for the test suite
If they're not set we'll still fall back to localhost, but this makes it
possible to run the tests against a remote Postgres / Redis / whatever.
2019-02-06 01:20:06 +10:30
Ryuta Kamizono
892e38c78e Enable Style/RedundantBegin cop to avoid newly adding redundant begin block
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).

I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
2018-12-21 06:12:42 +09:00
Yasuo Honda
d54d0c9575 Use utf8mb4 character set by default for MySQL database (#33608)
* Use utf8mb4 character set by default

`utf8mb4` character set supports supplementary characters including emoji.
`utf8` character set with 3-Byte encoding is not enough to support them.

There was a downside of 4-Byte length character set with MySQL 5.5 and 5.6:

"ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes"
for Rails string data type which is mapped to varchar(255) type.

MySQL 5.7 supports 3072 byte key prefix length by default.

* Remove `DEFAULT COLLATE` from Active Record unit test databases

There should be no "one size fits all" collation in MySQL 5.7.
Let MySQL server choose the default collation for Active Record
unit test databases.

Users can choose their best collation for their databases
by setting `options[:collation]` based on their requirements.

* InnoDB FULLTEXT indexes support since MySQL 5.6
it does not have to use MyISAM storage engine whose maximum key length is 1000 bytes.
Using MyISAM storag engine with utf8mb4 character set would cause
"Specified key was too long; max key length is 1000 bytes"

https://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html

* References

"10.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)"
https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html

"10.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)"
https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8.html

"14.8.1.7 Limits on InnoDB Tables"
https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html
> If innodb_large_prefix is enabled (the default), the index key prefix limit is 3072 bytes
> for InnoDB tables that use DYNAMIC or COMPRESSED row format.

* CI against MySQL 5.7

Followed this instruction and changed root password to empty string.
https://docs.travis-ci.com/user/database-setup/#MySQL-57

* The recommended minimum version of MySQL is 5.7.9
to support utf8mb4 character set and `innodb_default_row_format`

MySQL 5.7.9 introduces `innodb_default_row_format` to support 3072 byte length index by default.
Users do not have to change MySQL database configuration to support Rails string type.

https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_default_row_format

https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html
> If innodb_large_prefix is enabled (the default),
> the index key prefix limit is 3072 bytes for InnoDB tables that use DYNAMIC or COMPRESSED row format.

* The recommended minimum version of MariaDB is 10.2.2
MariaDB 10.2.2 is the first version of MariaDB supporting `innodb_default_row_format`
Also MariaDB says "MySQL 5.7 is compatible with MariaDB 10.2".

- innodb_default_row_format
https://mariadb.com/kb/en/library/xtradbinnodb-server-system-variables/#innodb_default_row_format

- "MariaDB versus MySQL - Compatibility"
https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/
> MySQL 5.7 is compatible with MariaDB 10.2

- "Supported Character Sets and Collations"
https://mariadb.com/kb/en/library/supported-character-sets-and-collations/
2018-09-11 13:03:34 -07:00
Yoshiyuki Hirano
b278e2f5c6 Display db:drop description in ActiveRecord 2018-04-03 14:24:04 +09:00
Ryuta Kamizono
2b35826389 Enable Layout/SpaceBeforeComma rubocop rule, and fixed more
Follow up of #31390.
2017-12-12 20:00:50 +09:00
Kir Shatrov
831be98f9a Use frozen-string-literal in ActiveRecord 2017-07-19 22:27:07 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
bogdanvlviv
6673cf7071
Use require_relative instead of require with full path 2017-06-14 12:10:17 +03:00
bogdanvlviv
40bdbce191
Define path with __dir__
".. with __dir__ we can restore order in the Universe." - by @fxn

Related to 5b8738c2df003a96f0e490c43559747618d10f5f
2017-05-23 00:53:51 +03:00
Sean Griffin
1511f0e738 Merge pull request #25927 from y-yagi/remove_needless_warning_for_hstore
remove needless warning for hstore
2017-01-03 16:15:58 -05:00
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Xavier Noria
bb1ecdcc67 fixes remaining RuboCop issues [Vipul A M, Xavier Noria] 2016-09-01 23:41:49 +02:00
yuuji.yaginuma
a899549ba2 remove needless warning for hstore
Rails 5 supports only Postgresql 9.1 or higher, warning is needless because
in the case of Postgresql 9.0 or less does not work.
2016-08-15 08:45:35 +09:00
Xavier Noria
d22e522179 modernizes hash syntax in activerecord 2016-08-06 19:37:57 +02:00
Xavier Noria
e6ab70c439 applies new string literal convention to the rest of the project
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:28:46 +02:00
Xavier Noria
99cf755800 systematic revision of =~ usage in AR
Where appropriatei, prefer the more concise Regexp#match?,
String#include?, String#start_with?, or String#end_with?
2016-07-23 20:22:20 +02:00
Javan Makhmali
d12209cad2 Remove package:clean task
Introduced in d6f2000a67cc63aa67414c75ce77de671824ec52 and was only used by Action Cable. Now handled by Action Cable’s assets:compile task.
2016-05-24 13:11:28 -04:00
Matthew Draper
d6f2000a67 Wrangle the asset build into something that sounds more general 2016-02-01 05:03:03 +10:30
Abdelkader Boudih
fb24d0ed6c Remove legacy mysql adapter 2015-12-17 15:54:57 +00:00
Yasuo Honda
329642325e Allow mysql and mysql2 tests run by database user with password 2015-08-18 12:59:19 +00:00
Sean Griffin
cc214cff7e Merge pull request #20256 from arunagw/aa-remove-unused-rule-and-task-activerecord
Remove unused rule and task from activerecord
2015-07-24 08:45:22 -06:00
Arun Agrawal
21b6b68f63 Remove unused package tasks
We are using `all:build` now.
2015-05-28 09:06:10 +02:00
Arun Agrawal
4194d052d8 Remove broken and unused release task
- We do release with release.rb
- There is no `rake/gemcutter`
2015-05-22 14:30:30 +02:00
Arun Agrawal
4f5f210a59 Remove unused rule and task from activerecord 2015-05-22 11:04:32 +02:00
Ronak Jangir
76fbfe9e6c Updated postgresql documentation link to use latest version [ci skip] 2015-05-20 14:00:31 +05:30
Matthew Draper
e462021396 Revert "For now, we will keep sorting the tests."
This reverts commit 7025d7769dc53f0a3ffab8b537727ef3fee367fc.
2015-03-06 04:39:20 +10:30
Robin Dupret
1fac7b79f3 Follow up to #16613
Since we want this flag to be enabled anytime we are running the tests
under JRuby, let's enable this at the Rakefile level so people get the
performance boost on their local checkout.

Moreover, we avoid having to update this particular line anytime the
option changes on the JRuby side.

The only drawback is that we have to define it in every Rakefile but
there's no big deal, this is already the case for other options.
2014-09-28 12:04:06 +02:00
Matthew Draper
7025d7769d For now, we will keep sorting the tests.
This reverts commits e969c928463e329fd6529ac59cad96385c538ffb and
bd2b3fbe54e750ba97469a7896e8d143d6dfd465.
2014-09-05 23:33:27 +09:30
Akira Matsuda
bd2b3fbe54 No need to sort tests
Dir.glob result must be already sorted anyway
2014-08-28 14:41:00 +09:00
Benjamin Fleischer
91d199259b Encapsulate rake lines from ActiveRecord/ActionPack as CodeTools::LineStatistics
[ci skip]
2014-07-25 13:41:18 -05:00
Arun Agrawal
da4d841e16 Reorganize ActiveRecord tasks [Arun Agrawal & Abd ar-Rahman Hamidi] 2014-05-16 23:09:05 +02:00
Arun Agrawal
0fcc1f9a61 Remove code related to adapter which are no longer in repo
As we have remove code for these adapters so no need to have tasks
2014-05-16 18:17:25 +02:00
Yves Senn
09cfa3fa8a rake, remove frontbase related tasks from Active Record Rakefile. 2014-05-14 21:25:52 +02:00
Yves Senn
b231825f3e Revert "Merge pull request #14940 from arunagw/hbakhtiyor-test-db-namespaces-ar"
This reverts commit fe9859600824268ff614cb3eb48b62c7165a1fbd, reversing
changes made to add9560643ef79830febf47fa1228752d1df3502.
2014-05-03 20:08:15 +02:00
Arun Agrawal
2de846852a Reorganize ActiveRecord tasks [Arun Agrawal & Abd ar-Rahman Hamidi] 2014-05-03 19:34:18 +02:00
Carlos Antonio da Silva
ea76386493 Add description for db:create and db:drop test tasks in AR
This will help identify these tasks exists, since they are easier to
setup things for running all AR tests.
2013-11-17 14:25:55 -02:00
Arun Agrawal
f52832de2a grab executable from rubygems
As done here d7fc97d3f90c0e30865d32ce202658f03248cacc
2013-07-26 11:07:25 +02:00
Vipul A M
1235b630fe Cleanup task for informing about hstore 2013-07-25 01:11:41 +05:30
Carlos Antonio da Silva
f02d4ddc99 Merge pull request #11046 from arunagw/verbose_mode_on
Verbose mode on when running tests
2013-06-25 15:15:43 -07:00
Arun Agrawal
d88b390dfd Adding verbose in isolated test. 2013-06-21 14:14:36 +02:00
Arun Agrawal
67f668845e Saying gemcutter => rubygems [ci skip] 2013-06-21 11:04:52 +02:00
Arun Agrawal
a84a08ecea No need to load 'rake/packagetask' as it's already
in 'rubygems/package_task'
2013-06-02 20:41:21 +02:00
kennyj
91c4d0b1e7 Remove unnecessary code, because this extension is created on demand in hstore_test.rb. 2013-05-15 12:47:49 +09:00
Ranjay Krishna
3e74012d66 added db:drop task that executes mysql:drop_databses and postgresql:drop_databases 2013-01-20 11:00:26 -08:00
Ranjay Krishna
e470ebfe4f removed the puts statement and simplified the execute statement 2013-01-20 09:48:55 -08:00