Skip to content

Commit

Permalink
RONDB-774: Add HASH tests to CI (#25)
Browse files Browse the repository at this point in the history
* Add hget_hset to CI
* Run benchmark before showing logs
* Added HASH to benchmarks in CI
* Also build Slash on MacOS in CI
* More randomness for INCR non-existing key
  • Loading branch information
olapiv authored Nov 22, 2024
1 parent 7e42ce8 commit 9324c0c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/build_test_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:

- run: brew install protobuf

- name: Build
- name: Build Slash
run: cd pink/third/slash/slash && make

- name: Build Pink
run: cd pink && make static_lib

build-and-run-redis-benchmark:
Expand Down Expand Up @@ -105,15 +108,17 @@ jobs:
# Running this multiple times to check for memory leaks and that overwrites/updates/deletes work
- name: Run tests multiple times
run: |
for i in {1..100}; do
for i in {1..50}; do
docker exec -w $DOCKER_WORK_DIR -i $CONTAINER_NAME bash -c \
"pink/rondis/tests/get_set.sh $((i % 2))"
"pink/rondis/tests/get_set.sh $((i % 3))"
docker exec -w $DOCKER_WORK_DIR -i $CONTAINER_NAME bash -c \
"pink/rondis/tests/hget_hset.sh $((i % 5)) $((i % 3))"
echo "Success in run $i"
done
- name: Run Redis benchmark
run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t incr,get,set,hget,hset,hincr -r 100 -P 10 --threads 3"

- name: Show Rondis logs
if: always()
run: cat $LOCAL_RONDIS_LOG

- name: Run Redis benchmark
run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t get,set -r 100 -P 10 --threads 3"
3 changes: 1 addition & 2 deletions pink/rondis/tests/get_set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ echo "Testing edge case large key length (Redis allows up to 512MB for the value
edge_value=$(head -c 100000 < /dev/zero | tr '\0' 'b')
set_and_get "$KEY:edge_large" "$edge_value"

key="key"
incr_key="$key:incr$RANDOM"
incr_key="$KEY:incr${RANDOM}${RANDOM}"
incr_output=$(redis-cli INCR "$incr_key")
incr_result=$(redis-cli GET "$incr_key")
if [[ "$incr_result" == 1 ]]; then
Expand Down
10 changes: 5 additions & 5 deletions pink/rondis/tests/hget_hset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

set -e

# Change key suffix using script arguments
HASH_KEY="key"
KEY_SUFFIX=${1:-0}
# Change key suffixes using script arguments
HASH_KEY_SUFFIX=${1:-0}
HASH_KEY="key_$HASH_KEY_SUFFIX"
KEY_SUFFIX=${2:-0}
KEY="test_key_$KEY_SUFFIX"

# Function to set a value and retrieve it, then verify if it matches
Expand Down Expand Up @@ -107,8 +108,7 @@ echo "Testing edge case large key length (Redis allows up to 512MB for the value
edge_value=$(head -c 100000 < /dev/zero | tr '\0' 'b')
hset_and_hget "$KEY:edge_large" "$edge_value"

field="key"
incr_field="$field:incr$RANDOM"
incr_field="$KEY:incr${RANDOM}${RANDOM}"
incr_output=$(redis-cli HINCR "$HASH_KEY" "$incr_field")
incr_result=$(redis-cli HGET "$HASH_KEY" "$incr_field")
if [[ "$incr_result" == 1 ]]; then
Expand Down

0 comments on commit 9324c0c

Please sign in to comment.