15 Commits

Author SHA1 Message Date
Issy Long
e1ad07190e
rubocop: Fix RSpec/ContextWording offenses
- For some of these I changed `context` to `describe` as it fit better
  rather than contriving a "when", "with" or "without", or massively
  restructuring the tests.
2021-02-19 23:30:41 +00:00
Rylan Polster
af40e072b0
style: remove RSpec/NamedSubject violations 2021-02-01 20:30:51 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid
3d436d3664 Improve linkage cache linkage_cache_performance
- Use reference counting so nested `CacheStoreDatabase.use` share the
  same underlying database (rather than rereading it every time).
- Only write out the cache database file when it has changed.
- Cleanup cache database entries on formula or full `brew cleanup`.

Fixes #8690
2020-09-11 12:57:15 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
75257886f2
Cleanup some RSpec tests
Fix some Rubocop RSpec checks, update some values and improve
documentation.
2019-03-28 19:16:56 +00:00
Mike McQuaid
8b5f64881c
cache_store: use JSON.
After all our recent troubles with DBM I figured I'd benchmark the
performance of DBM vs. JSON. At read time (what we care more about) the
performance is pretty much identical and JSON is only 1.5x slower at
write time. This seems worth it for the reliability increases to avoid
messing with unreliable native code.
2018-09-25 21:07:01 +01:00
Mike McQuaid
f99f1b611f
cache_store_spec: fix bad rebase.
https://github.com/Homebrew/brew/pull/4948#discussion_r219276137
2018-09-21 14:36:38 +01:00
Mike McQuaid
359fb27cfe
Manually fix RuboCop RSpec autofix failures. 2018-09-20 13:40:38 +01:00
Mike McQuaid
78eba5b815
Autofix RuboCop RSpec failures 2018-09-20 13:36:42 +01:00
Mike McQuaid
a11fe57cd2
cache_store: handle corrupt DBM database.
When the DBM database cannot be read by the current version of Ruby's
DBM library (due to corruption or another incompatibility) it segfaults
or freezes which takes down the entire Homebrew Ruby process.

This isn't desirable so instead perform a shell out with the Homebrew
Ruby to see if it can read the DBM database before we try to use the
information. If this hangs or crashes: silently delete the database and
recreate it.
2018-09-20 10:57:27 +01:00
Markus Reiter
78d4db2755 Use classes for instance doubles. 2018-09-06 09:13:21 +02:00
Markus Reiter
579a30c7bf Fix rspec deprecations. 2018-05-25 23:19:13 +02:00
Andrew R. McBurney
218a7362dc Fixed failing tests. 2018-05-22 15:31:58 -04:00
Andrew R. McBurney
91f7a5eb76 Added unit tests for CacheStoreDatabase and LinkageCacheStore. 2018-05-22 15:01:56 -04:00