@@ -187,6 +187,59 @@ jobs:
187187 name : regression_logs
188188 path : /tmp/failed/*
189189
190+ - name : Upload dragonfly binary for cgroup test
191+ if : matrix.container == 'ubuntu-dev:24' && matrix.build-type == 'Release' && matrix.sanitizers == 'NoSanitizers' && matrix.compiler.cxx == 'g++'
192+ uses : actions/upload-artifact@v7
193+ with :
194+ name : dragonfly-binary
195+ path : ${{ github.workspace }}/build/dragonfly
196+ retention-days : 1
197+
198+ cgroup-thread-detection :
199+ runs-on : ubuntu-latest
200+ needs : [build]
201+ steps :
202+ - uses : actions/checkout@v6
203+
204+ - uses : actions/download-artifact@v7
205+ with :
206+ name : dragonfly-binary
207+ path : build
208+
209+ - name : Test cgroup CPU auto-detection
210+ run : |
211+ chmod +x build/dragonfly
212+
213+ # Scenario 1: --cpus=2, no flag -> should auto-detect 2 threads
214+ CID=$(docker run --rm -d --cpus=2 --security-opt seccomp=unconfined \
215+ -v "$PWD/build/dragonfly:/dragonfly" -p 16380:6379 ubuntu:24.04 \
216+ /dragonfly --port 6379 --maxmemory 1G --dbfilename "" --noversion_check)
217+
218+ for i in $(seq 1 20); do
219+ sleep 1
220+ redis-cli -p 16380 PING 2>/dev/null | grep -q PONG && break
221+ done
222+
223+ THREADS=$(redis-cli -p 16380 INFO server | grep -oP 'thread_count:\K\d+')
224+ docker rm -f "$CID"
225+ echo "Scenario 1: expected 2, got $THREADS"
226+ [ "$THREADS" -eq 2 ]
227+
228+ # Scenario 2: --cpus=2 + --proactor_threads=4 -> flag must win
229+ CID=$(docker run --rm -d --cpus=2 --security-opt seccomp=unconfined \
230+ -v "$PWD/build/dragonfly:/dragonfly" -p 16381:6379 ubuntu:24.04 \
231+ /dragonfly --port 6379 --proactor_threads 4 --maxmemory 1G --dbfilename "" --noversion_check)
232+
233+ for i in $(seq 1 20); do
234+ sleep 1
235+ redis-cli -p 16381 PING 2>/dev/null | grep -q PONG && break
236+ done
237+
238+ THREADS=$(redis-cli -p 16381 INFO server | grep -oP 'thread_count:\K\d+')
239+ docker rm -f "$CID"
240+ echo "Scenario 2: expected 4, got $THREADS"
241+ [ "$THREADS" -eq 4 ]
242+
190243 lint-test-chart :
191244 runs-on : ubuntu-latest
192245 needs : [build]
0 commit comments