Skip to content

Commit

Permalink
Add size limit for storing in the DB
Browse files Browse the repository at this point in the history
  • Loading branch information
michelemin committed Jan 21, 2025
1 parent bf86457 commit f46c09f
Show file tree
Hide file tree
Showing 15 changed files with 748 additions and 431 deletions.
82 changes: 46 additions & 36 deletions modules/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion modules/tests/test_db/harness/harness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ curl -d "delete:my_key" http://$PLAID_LOCATION/webhook/$URL
curl -d "get:my_key" http://$PLAID_LOCATION/webhook/$URL
curl -d "delete:another_key" http://$PLAID_LOCATION/webhook/$URL
curl -d "get:another_key" http://$PLAID_LOCATION/webhook/$URL
# At this point the DB is empty
curl -d "insert:my_key:first_value" http://$PLAID_LOCATION/webhook/$URL
curl -d "insert:a_key:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" http://$PLAID_LOCATION/webhook/$URL # too many bytes for the configured storage limit
curl -d "get:a_key" http://$PLAID_LOCATION/webhook/$URL # Empty because insertion failed
curl -d "insert:a_key:a" http://$PLAID_LOCATION/webhook/$URL # this is within the limit, so it's fine
curl -d "get:a_key" http://$PLAID_LOCATION/webhook/$URL # a
curl -d "delete:my_key" http://$PLAID_LOCATION/webhook/$URL
curl -d "delete:a_key" http://$PLAID_LOCATION/webhook/$URL
# now the DB is empty, so we can insert the long key/value pair
curl -d "insert:a_key:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" http://$PLAID_LOCATION/webhook/$URL
curl -d "get:a_key" http://$PLAID_LOCATION/webhook/$URL

sleep 2

Expand All @@ -40,8 +51,11 @@ kill $RH_PID 2>&1 > /dev/null
# second_value
# Empty
# Empty
# Empty
# a
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

echo -e "Empty\nEmpty\nfirst_value\nEmpty\nsecond_value\nEmpty\nEmpty" > expected.txt
echo -e "Empty\nEmpty\nfirst_value\nEmpty\nsecond_value\nEmpty\nEmpty\nEmpty\na\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > expected.txt
diff expected.txt $FILE
RESULT=$?

Expand Down
Loading

0 comments on commit f46c09f

Please sign in to comment.