-
Notifications
You must be signed in to change notification settings - Fork 126
test(starry,nginx): implement alpine nginx normal tests #1038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
39becfa
test(starry,nginx): cover most nginx test scenarios
Antareske 2991b1b
test(starry,nginx): complete remaining non-stress phase probes
Antareske 59e4b6e
docs(starry): restore MariaDB section in app README
Antareske 35e9444
test(starry,nginx): reuse shared alpine mirror helper in phase tests
Antareske 7e0dbdc
test(starry,nginx): tighten smoke POST assertion and log keepalive skips
Antareske 5e72eea
test(starry,nginx): fix mirror rc handling and align smoke test configs
Antareske dabf27a
test(starry,nginx): 补齐 nginx smoke CI
Antareske becbd30
test(starry,nginx): align qemu docs and skip large file
Antareske 5c8da0a
test(starry,nginx): stabilize smoke apk/keepalive on starry rootfs
Antareske 3bf271d
test(starry,nginx): align build configs and raise loongarch64 memory
Antareske 50d6410
test(starry,nginx): clarify local retest docs
Antareske 3dafe4e
docs(starry): remove duplicate MariaDB section
Antareske ecd92c2
test(starry,nginx): include all phase CLI entrypoints
Antareske 11abaf3
test(starry,nginx): align qemu entrypoints and debug assets
Antareske 82a72d3
docs(starry,nginx): align nginx entrypoint docs
Antareske da24648
docs(starry,nginx): clarify manual test entries
Antareske File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
apps/starry/nginx/build-aarch64-unknown-none-softfloat.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| target = "aarch64-unknown-none-softfloat" | ||
| log = "Warn" | ||
| features = [ | ||
| "qemu", | ||
| "ax-driver/virtio-blk", | ||
| "ax-driver/virtio-net", | ||
| "ax-driver/virtio-gpu", | ||
| "ax-driver/virtio-input", | ||
| "ax-driver/virtio-socket", | ||
| ] |
14 changes: 14 additions & 0 deletions
14
apps/starry/nginx/build-loongarch64-unknown-none-softfloat.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| target = "loongarch64-unknown-none-softfloat" | ||
| axconfig_overrides = ["plat.phys-memory-size=0x8000_0000"] | ||
| log = "Warn" | ||
| features = [ | ||
| "ax-hal/loongarch64-qemu-virt", | ||
| "qemu", | ||
| "ax-driver/plat-static", | ||
| "ax-driver/virtio-blk", | ||
| "ax-driver/virtio-net", | ||
| "ax-driver/virtio-gpu", | ||
| "ax-driver/virtio-input", | ||
| "ax-driver/virtio-socket", | ||
| ] | ||
| plat_dyn = false |
49 changes: 49 additions & 0 deletions
49
apps/starry/nginx/debug/ISSUE-004-bad-method-probe-instability.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # ISSUE-004: BAD Method Probe Instability | ||
|
|
||
| ## Status | ||
|
|
||
| - State: deferred (temporarily bypassed in phase2) | ||
| - Scope: `BAD / HTTP/1.1` verification path in stage 2 | ||
| - Impact: does not block phase2 main flow | ||
|
|
||
| ## Symptom | ||
|
|
||
| - In some runs, `busybox nc` returns an empty response (`<empty>`) for both: | ||
| - `BAD / HTTP/1.1` | ||
| - `GET / HTTP/1.1` | ||
| - This can make a strict raw-probe assertion fail even when nginx behavior is normal. | ||
|
|
||
| ## Confirmed Observations | ||
|
|
||
| - `curl -X BAD http://127.0.0.1:8080/...` stably returns `405`. | ||
| - `nc.openbsd` raw BAD request stably returns `HTTP/1.1 405 Not Allowed`. | ||
| - `busybox nc` may return `<empty>` under the same request pattern. | ||
|
|
||
| ## Current Decision | ||
|
|
||
| - Keep phase2 BAD-method node as bypass (known issue log only). | ||
| - Do not use `busybox nc` as pass/fail oracle for this node. | ||
| - Continue tracking through debug scripts: | ||
| - `nginx-2-0-bad-method-debug.sh` | ||
| - `nginx-2-0-bad-method-matrix.sh` | ||
|
|
||
| ## Repro Commands | ||
|
|
||
| ```bash | ||
| cargo xtask starry app qemu -t nginx --arch x86_64 --qemu-config apps/starry/nginx/qemu-x86_64-bad-method-debug.toml | ||
| cargo xtask starry app qemu -t nginx --arch x86_64 --qemu-config apps/starry/nginx/qemu-x86_64-bad-method-matrix.toml | ||
| ``` | ||
|
|
||
| Optional phase2 retest: | ||
|
|
||
| ```bash | ||
| cargo xtask starry app qemu -t nginx --arch riscv64 --qemu-config apps/starry/nginx/qemu-riscv64-phase2.toml | ||
| cargo xtask starry app qemu -t nginx --arch x86_64 --qemu-config apps/starry/nginx/qemu-x86_64-phase2.toml | ||
| ``` | ||
|
|
||
| ## Next Follow-up | ||
|
|
||
| - Add a minimal socket-level probe outside nginx to isolate whether this is: | ||
| - `busybox nc` behavior under StarryOS, or | ||
| - StarryOS socket timing/EOF behavior exposed by `busybox nc`. | ||
| - After root cause is confirmed and fixed, restore strict assertion for the phase2 BAD-method node. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| #!/bin/sh | ||
| set -eu | ||
|
|
||
| BASE=/tmp/nginx-phase2-bad-method | ||
| CONF="$BASE/conf/http-basic.conf" | ||
| WWW="$BASE/www" | ||
| OUT="$BASE/out" | ||
| LOGDIR="$BASE/logs" | ||
| TIMEOUT_CMD= | ||
|
|
||
| log() { printf 'NGINX_BAD_METHOD_DEBUG_LOG: %s\n' "$*"; } | ||
| fail() { printf 'NGINX_BAD_METHOD_DEBUG_FAILED\n'; log "$*"; exit 1; } | ||
|
|
||
| init_timeout_cmd() { | ||
| if command -v timeout >/dev/null 2>&1; then TIMEOUT_CMD='timeout'; return; fi | ||
| if busybox timeout 2>&1 | grep -qi 'usage'; then TIMEOUT_CMD='busybox timeout'; return; fi | ||
| fail "timeout command not available" | ||
| } | ||
|
|
||
| run_with_timeout() { sec=$1; shift; $TIMEOUT_CMD "$sec" "$@"; } | ||
|
|
||
| cleanup_nginx() { | ||
| killall -q nginx 2>/dev/null || true | ||
| sleep 1 | ||
| killall -q -9 nginx 2>/dev/null || true | ||
| } | ||
|
|
||
| prepare_packages() { | ||
| repo_file=/etc/apk/repositories | ||
| original_repos="$(cat "$repo_file")" | ||
| for mirror in https://mirrors.cernet.edu.cn/alpine https://dl-cdn.alpinelinux.org/alpine; do | ||
| printf '%s\n' "$original_repos" | sed "s#http://[^/]*/alpine/#$mirror/#g;s#https://[^/]*/alpine/#$mirror/#g" > "$repo_file" | ||
| rm -f /lib/apk/db/lock | ||
| if run_with_timeout 40 apk --timeout 40 update && run_with_timeout 40 apk --timeout 40 add nginx curl busybox-extras; then return 0; fi | ||
| done | ||
| return 1 | ||
| } | ||
|
|
||
| prepare_tree() { | ||
| rm -rf "$BASE" | ||
| mkdir -p "$BASE/conf" "$WWW" "$LOGDIR" "$OUT" | ||
| printf 'BAD_METHOD_DEBUG_OK\n' > "$WWW/index.html" | ||
| cat > "$CONF" <<'EOF' | ||
| daemon off; | ||
| master_process off; | ||
| worker_processes 1; | ||
| error_log /tmp/nginx-phase2-bad-method/logs/error.log debug; | ||
| pid /tmp/nginx-phase2-bad-method/nginx.pid; | ||
| events { worker_connections 64; } | ||
| http { include /etc/nginx/mime.types; access_log /tmp/nginx-phase2-bad-method/logs/access.log; server { listen 127.0.0.1:8080; root /tmp/nginx-phase2-bad-method/www; location / { index index.html; } } } | ||
| EOF | ||
| } | ||
|
|
||
| start_nginx() { | ||
| nginx -t -c "$CONF" -p "$BASE/" || return 1 | ||
| nginx -c "$CONF" -p "$BASE/" > "$LOGDIR/nginx-stdout.log" 2>&1 & | ||
| i=0 | ||
| while [ "$i" -lt 6 ]; do | ||
| run_with_timeout 1 curl -fsS -o /dev/null http://127.0.0.1:8080/ >/dev/null 2>&1 && return 0 | ||
| i=$((i + 1)) | ||
| sleep 1 | ||
| done | ||
| return 1 | ||
| } | ||
|
|
||
| probe_bad_method() { | ||
| if command -v nc >/dev/null 2>&1; then | ||
| NC='nc' | ||
| elif busybox nc 2>&1 | grep -qi 'usage'; then | ||
| NC='busybox nc' | ||
| else | ||
| fail "nc not available" | ||
| fi | ||
| code=$(run_with_timeout 3 curl -sS -o /dev/null -w '%{http_code}' -X BAD http://127.0.0.1:8080/ || true) | ||
| [ -n "$code" ] || code='<empty>' | ||
| log "curl_bad_method_status=$code" | ||
|
|
||
| i=1 | ||
| while [ "$i" -le 5 ]; do | ||
| out="$OUT/bad-$i.raw" | ||
| { printf 'BAD / HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n'; } | run_with_timeout 4 sh -c "$NC 127.0.0.1 8080" > "$out" || true | ||
| tr -d '\r' < "$out" > "$OUT/bad-$i.norm" | ||
| status=$(sed -n '1p' "$OUT/bad-$i.norm" || true) | ||
| [ -n "$status" ] || status='<empty>' | ||
| log "probe=$i status=$status" | ||
| i=$((i + 1)) | ||
| done | ||
| if grep -Eq '^HTTP/1.1 (400|405)' "$OUT"/bad-*.norm; then | ||
| printf 'NGINX_BAD_METHOD_DEBUG_PASSED\n' | ||
| return 0 | ||
| fi | ||
| log "no 400/405 hit in 5 probes" | ||
| return 1 | ||
| } | ||
|
|
||
| init_timeout_cmd | ||
| ( sleep 90; log "watchdog timeout"; kill -TERM $$ ) & | ||
| prepare_packages || fail "prepare packages" | ||
| prepare_tree || fail "prepare tree" | ||
| start_nginx || fail "start nginx" | ||
| probe_bad_method || { | ||
| if [ -f "$LOGDIR/error.log" ]; then | ||
| tail_line=$(sed -n '$p' "$LOGDIR/error.log" || true) | ||
| [ -n "$tail_line" ] || tail_line='<empty>' | ||
| log "error_log_tail=$tail_line" | ||
| fi | ||
| cleanup_nginx | ||
| fail "bad method probes" | ||
| } | ||
| cleanup_nginx |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.