Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed KERI_BASER_MAP_SIZE not integer bug. #812

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion src/keri/db/basing.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,10 @@ def __init__(self, headDirPath=None, reopen=False, **kwa):
self._kevers.db = self # assign db for read through cache of kevers

if (mapSize := os.getenv(KERIBaserMapSizeKey)) is not None:
self.MapSize = int(mapSize)
try:
self.MapSize = int(mapSize)
except ValueError:
logger.exception("KERI_BASER_MAP_SIZE must be an integer value! Will continue to use default keripy value of 104857600!")
pfeairheller marked this conversation as resolved.
Show resolved Hide resolved

super(Baser, self).__init__(headDirPath=headDirPath, reopen=reopen, **kwa)

Expand Down
10 changes: 10 additions & 0 deletions tests/db/test_basing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,16 @@ def test_group_members():

"""End Test"""

def test_KERI_BASER_MAP_SIZE_handles_bad_values():
# Base case works because of above tests, they will all break if happy path
# is broken. We'll just test some unhappy values.

# Pytest will fail if any exceptions raised here.
os.putenv("KERI_BASER_MAP_SIZE", "foo") # Not an int
baser = Baser(reopen=False)
os.putenv("KERI_BASER_MAP_SIZE", "1.0") # Not an int
baser = Baser(reopen=False)


if __name__ == "__main__":
test_baser()
Expand Down
Loading