Skip to content

Commit

Permalink
Change storage root to moab and db to catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
SaravShah committed Oct 5, 2017
1 parent d31162b commit e43d59b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RSpec/ExampleLength:
RSpec/MultipleExpectations:
Max: 2

Rspec/MessageSpies:
RSpec/MessageSpies:
Exclude:
- 'spec/services/preserved_object_handler_spec.rb' # couldn't figure out a logging test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
##
# Method that will check the a single online service disk for the existence of moabs in postgres database
class StorageRootToDB
def self.check_online_to_db_existence(storage_dir)
# Method that will check the a single moab service disk for the existence of moabs in postgres database
class MoabToCatalog
def self.check_moab_to_catalog_existence(storage_dir)
results = []
MoabStorageDirectory.find_moab_paths(storage_dir) do |druid, _path, _path_match_data|
storage_root_current_version = Stanford::StorageServices.current_version(druid)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require 'benchmark'
require 'logger'
require_relative "../audit/storage_root_to_db.rb"
require_relative "../audit/moab_to_catalog.rb"
require 'ruby-prof'

logger = Logger.new('log/benchmark_storage_root_to_db.log')
at_exit do # File.open "/tmp/StorageRootToDB_rubyprof_#{Time.now.getlocal}", 'w' do |file|
File.open "#{pcc_app_home}/current/log/StorageRootToDB_rubyprof_#{Time.now.getlocal}", 'w' do |file|
logger = Logger.new('log/benchmark_moab_to_catalog.log')
at_exit do # File.open "/tmp/MoabtoCatalog_rubyprof_#{Time.now.getlocal}", 'w' do |file|
File.open "#{pcc_app_home}/current/log/MoabtoCatalog_rubyprof_#{Time.now.getlocal}", 'w' do |file|
RubyProf::FlatPrinter.new(@prof).print(file)
end
logger.info "Benchmarking stopped at #{Time.now.getlocal}"
Expand All @@ -31,7 +31,7 @@
time_to_check_existence = Benchmark.realtime do
RubyProf.start
logger.info "Check for output"
StorageRootToDB.check_online_to_db_existence(storage_dir)
StorageRootToDB.check_moab_to_catalog_existence(storage_dir)
@prof = RubyProf.stop
end
logger.info time_to_check_existence.to_s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require_relative "../../../lib/audit/storage_root_to_db.rb"
RSpec.describe StorageRootToDB do
describe ".check_online_to_db_existence" do
require_relative "../../../lib/audit/moab_to_catalog.rb"
RSpec.describe MoabToCatalog do
describe ".check_moab_to_catalog_existence" do
before do
PreservationPolicy.seed_from_config
end

let(:storage_dir) { 'spec/fixtures/moab_storage_trunk' }
let(:subject) { described_class.check_online_to_db_existence(storage_dir) }
let(:subject) { described_class.check_moab_to_catalog_existence(storage_dir) }

it "call 'find_moab_paths' with appropriate argument" do
allow(MoabStorageDirectory).to receive(:find_moab_paths).with(storage_dir)
Expand Down Expand Up @@ -44,14 +44,14 @@
end

it "storage directory doesn't exist (misspelling, read write permissions)" do
expect { described_class.check_online_to_db_existence('spec/fixtures/moab_strge_root') }.to raise_error(
expect { described_class.check_moab_to_catalog_existence('spec/fixtures/moab_strge_root') }.to raise_error(
SystemCallError, /No such file or directory/
)
end

it "storage directory exists but it is empty" do
storage_dir = 'spec/fixtures/empty'
expect(described_class.check_online_to_db_existence(storage_dir)).to eq []
expect(described_class.check_moab_to_catalog_existence(storage_dir)).to eq []
end

end
Expand Down

0 comments on commit e43d59b

Please sign in to comment.