From 410e23085eb83844e02e5e83cfff39fc2f1fcf58 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Fri, 6 Sep 2019 10:30:26 +0200 Subject: [PATCH] Remove integrity check for deleted variants in OCs We have no way to see the output of this weird RSpec integrity check thus, it's pointless. It only adds unnecessary load the server. However, the issue it checks seems to still be happening although not very often. UK's server has 70 occurrences the last one being from early 2019 while FR's server returns 10. --- config/schedule.rb | 4 ---- lib/open_food_network/integrity_checker.rb | 22 ---------------------- 2 files changed, 26 deletions(-) delete mode 100644 lib/open_food_network/integrity_checker.rb diff --git a/config/schedule.rb b/config/schedule.rb index 3685d68c47..9ad169cacf 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -16,10 +16,6 @@ every 1.day, at: '01:00am' do rake 'ofn:cache:check_products_integrity' end -every 1.day, at: '12:05am' do - run_file "lib/open_food_network/integrity_checker.rb" -end - every 1.day, at: '2:45am' do rake 'db2fog:clean' if ENV['S3_BACKUPS_BUCKET'] end diff --git a/lib/open_food_network/integrity_checker.rb b/lib/open_food_network/integrity_checker.rb deleted file mode 100644 index 4bf4444c14..0000000000 --- a/lib/open_food_network/integrity_checker.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'rspec/rails' -require 'rspec/autorun' - -# This spec file is one part of a two-part strategy to maintain data integrity. The first part -# is to proactively protect data integrity using database constraints (not null, foreign keys, -# etc) and ActiveRecord validations. As a backup to those two techniques, and particularly in -# the cases where it's not possible to model an integrity concern with database constraints, -# we can add a reactive integrity test here. - -# These tests are run nightly and the results are emailed to the MAILTO address in -# config/schedule.rb if any failures occur. - -# Ref: http://pluralsight.com/training/Courses/TableOfContents/database-your-friend - -describe "data integrity" do - it "has no deleted variants in order cycles" do - # When a variant is soft deleted, it should be removed from all order cycles - # via Spree::Product#delete or Spree::Variant#delete. - evs = ExchangeVariant.joins(:variant).where('spree_variants.deleted_at IS NOT NULL') - evs.count.should == 0 - end -end