Skip to content

Commit 9324c0c

Browse files
authoredNov 22, 2024
RONDB-774: Add HASH tests to CI (#25)
* 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
1 parent 7e42ce8 commit 9324c0c

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed
 

‎.github/workflows/build_test_push.yaml

+11-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ jobs:
1616

1717
- run: brew install protobuf
1818

19-
- name: Build
19+
- name: Build Slash
20+
run: cd pink/third/slash/slash && make
21+
22+
- name: Build Pink
2023
run: cd pink && make static_lib
2124

2225
build-and-run-redis-benchmark:
@@ -105,15 +108,17 @@ jobs:
105108
# Running this multiple times to check for memory leaks and that overwrites/updates/deletes work
106109
- name: Run tests multiple times
107110
run: |
108-
for i in {1..100}; do
111+
for i in {1..50}; do
109112
docker exec -w $DOCKER_WORK_DIR -i $CONTAINER_NAME bash -c \
110-
"pink/rondis/tests/get_set.sh $((i % 2))"
113+
"pink/rondis/tests/get_set.sh $((i % 3))"
114+
docker exec -w $DOCKER_WORK_DIR -i $CONTAINER_NAME bash -c \
115+
"pink/rondis/tests/hget_hset.sh $((i % 5)) $((i % 3))"
111116
echo "Success in run $i"
112117
done
113118
119+
- name: Run Redis benchmark
120+
run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t incr,get,set,hget,hset,hincr -r 100 -P 10 --threads 3"
121+
114122
- name: Show Rondis logs
115123
if: always()
116124
run: cat $LOCAL_RONDIS_LOG
117-
118-
- name: Run Redis benchmark
119-
run: docker exec -i $CONTAINER_NAME bash -c "redis-benchmark -t get,set -r 100 -P 10 --threads 3"

‎pink/rondis/tests/get_set.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ echo "Testing edge case large key length (Redis allows up to 512MB for the value
106106
edge_value=$(head -c 100000 < /dev/zero | tr '\0' 'b')
107107
set_and_get "$KEY:edge_large" "$edge_value"
108108

109-
key="key"
110-
incr_key="$key:incr$RANDOM"
109+
incr_key="$KEY:incr${RANDOM}${RANDOM}"
111110
incr_output=$(redis-cli INCR "$incr_key")
112111
incr_result=$(redis-cli GET "$incr_key")
113112
if [[ "$incr_result" == 1 ]]; then

‎pink/rondis/tests/hget_hset.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
set -e
44

5-
# Change key suffix using script arguments
6-
HASH_KEY="key"
7-
KEY_SUFFIX=${1:-0}
5+
# Change key suffixes using script arguments
6+
HASH_KEY_SUFFIX=${1:-0}
7+
HASH_KEY="key_$HASH_KEY_SUFFIX"
8+
KEY_SUFFIX=${2:-0}
89
KEY="test_key_$KEY_SUFFIX"
910

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

110-
field="key"
111-
incr_field="$field:incr$RANDOM"
111+
incr_field="$KEY:incr${RANDOM}${RANDOM}"
112112
incr_output=$(redis-cli HINCR "$HASH_KEY" "$incr_field")
113113
incr_result=$(redis-cli HGET "$HASH_KEY" "$incr_field")
114114
if [[ "$incr_result" == 1 ]]; then

0 commit comments

Comments
 (0)