@@ -187,6 +187,82 @@ 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 : Install redis-tools
210+ run : sudo apt-get update && sudo apt-get install -y redis-tools
211+
212+ - name : Prepare cgroup test image
213+ run : |
214+ chmod +x build/dragonfly
215+ # Verify the binary's runtime dependencies and install them in a local image.
216+ # The binary is built in ubuntu-dev:24 and links dynamically against Boost,
217+ # which is not present in the minimal ubuntu:24.04 image.
218+ echo "Runtime deps of dragonfly binary:"
219+ ldd build/dragonfly
220+ docker build -t df-cgroup-test - <<'EOF'
221+ FROM ubuntu:24.04
222+ RUN apt-get update -qq && \
223+ apt-get install -y --no-install-recommends libboost-context1.83.0 libssl3 && \
224+ rm -rf /var/lib/apt/lists/*
225+ EOF
226+
227+ - name : Test cgroup CPU auto-detection
228+ run : |
229+ wait_for_server() {
230+ local port=$1
231+ local cid=$2
232+ for i in $(seq 1 30); do
233+ sleep 1
234+ redis-cli -p "$port" PING 2>/dev/null | grep -q PONG && return 0
235+ done
236+ echo "ERROR: dragonfly on port $port did not start within 30s"
237+ docker logs "$cid" 2>&1 || true
238+ docker rm -f "$cid" 2>/dev/null || true
239+ return 1
240+ }
241+
242+ # Scenario 1: --cpus=2, no flag -> should auto-detect 2 threads
243+ CID=$(docker run --rm -d --cpus=2 --security-opt seccomp=unconfined \
244+ -v "$PWD/build/dragonfly:/dragonfly" -p 16380:6379 df-cgroup-test \
245+ /dragonfly --port 6379 --maxmemory 1G --dbfilename "" --noversion_check)
246+
247+ wait_for_server 16380 "$CID"
248+
249+ THREADS=$(redis-cli -p 16380 INFO server | grep -oP 'thread_count:\K\d+')
250+ docker rm -f "$CID" 2>/dev/null || true
251+ echo "Scenario 1: expected 2, got $THREADS"
252+ [ "$THREADS" -eq 2 ]
253+
254+ # Scenario 2: --cpus=2 + --proactor_threads=4 -> flag must win
255+ CID=$(docker run --rm -d --cpus=2 --security-opt seccomp=unconfined \
256+ -v "$PWD/build/dragonfly:/dragonfly" -p 16381:6379 df-cgroup-test \
257+ /dragonfly --port 6379 --proactor_threads 4 --maxmemory 1G --dbfilename "" --noversion_check)
258+
259+ wait_for_server 16381 "$CID"
260+
261+ THREADS=$(redis-cli -p 16381 INFO server | grep -oP 'thread_count:\K\d+')
262+ docker rm -f "$CID" 2>/dev/null || true
263+ echo "Scenario 2: expected 4, got $THREADS"
264+ [ "$THREADS" -eq 4 ]
265+
190266 lint-test-chart :
191267 runs-on : ubuntu-latest
192268 needs : [build]
0 commit comments