Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
entitlements-app (1.2.0)
entitlements-app (1.2.1)
concurrent-ruby (~> 1.3, >= 1.3.1)
faraday (~> 2.0)
logger (~> 1.6)
Expand Down
2 changes: 2 additions & 0 deletions lib/entitlements/data/groups/cached.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def self.load_caches(dir)
Entitlements.cache[:predictive_state][:by_ou][ou] ||= {}
Entitlements.cache[:predictive_state][:by_ou][ou][identifier] = member_set
Entitlements.cache[:predictive_state][:by_dn][dn] = { members: member_set, metadata: metadata }
rescue => e
raise "Failed to load predictive state cache file #{filename}: #{e.message}"
end

Entitlements.logger.debug "Loaded #{Entitlements.cache[:predictive_state][:by_ou].keys.size} OU(s) from cache"
Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module Entitlements
module Version
VERSION = "1.2.0"
VERSION = "1.2.1"
end
end
12 changes: 12 additions & 0 deletions spec/unit/entitlements/data/groups/cached_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
end
end

context "with a file that fails to parse" do
let(:dir) { fixture("predictive-state/failing-cache") }

it "raises with a custom message" do
expect(logger).to receive(:debug).with("Loading predictive update caches from #{dir}")

expect do
described_class.load_caches(dir)
end.to raise_error(RuntimeError, /Failed to load predictive state cache file/)
end
end

context "with valid predictive state directory" do
let(:dir) { fixture("predictive-state/cache1") }

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metadata_is_missing_a_value
Loading