Skip to content

Commit

Permalink
Merge "BugFix: 500 Server error when upgrade and service restart with…
Browse files Browse the repository at this point in the history
… data in DB"
  • Loading branch information
sourabh-est authored and Gerrit Code Review committed Sep 30, 2024
2 parents 4baa75b + fe846d2 commit 78674d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void updateCmHandleTrustLevel(final String cmHandleId,
*/
public TrustLevel getEffectiveTrustLevel(final String cmHandleId) {
final TrustLevel dmiTrustLevel = TrustLevel.COMPLETE; // TODO: CPS-2375
final TrustLevel cmHandleTrustLevel = trustLevelPerCmHandle.get(cmHandleId);
final TrustLevel cmHandleTrustLevel = trustLevelPerCmHandle.getOrDefault(cmHandleId, TrustLevel.NONE);
return dmiTrustLevel.getEffectiveTrustLevel(cmHandleTrustLevel);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ class TrustLevelManagerSpec extends Specification {
assert effectiveTrustLevel == TrustLevel.NONE
}

def 'Select effective trust level when the trust level caches are empty (restart case)'() {
expect: 'effective trust level is NONE when cm-1 does not exist in the cache'
assert objectUnderTest.getEffectiveTrustLevel('ch-1') == TrustLevel.NONE
}
def 'CmHandle trust level removed'() {
given: 'a cm handle'
trustLevelPerCmHandle.put('ch-1', TrustLevel.COMPLETE)
Expand Down

0 comments on commit 78674d7

Please sign in to comment.