Skip to content

Commit 26cb5c7

Browse files
committed
fix(ci): 修复 uat-bypass lint 失败 + build 多包 -o 报错
- helpers_linux.go: 裸 time.Sleep → harness.WaitFor,消除 lint-no-bare-sleep 报错 - uat-bypass.yml: go build 限定到 ./cmd/control-plane,修复多包 -o 非法
1 parent 06d2a6d commit 26cb5c7

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

.github/workflows/uat-bypass.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123

124124
- name: Build control plane
125125
if: steps.preflight.outputs.fixture_available == 'true'
126-
run: go build -o /tmp/cloud-cli-proxy ./cmd/...
126+
run: go build -o /tmp/cloud-cli-proxy ./cmd/control-plane
127127

128128
- name: Bring up bypass fixture
129129
if: steps.preflight.outputs.fixture_available == 'true'

tests/e2e/helpers_linux.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,7 @@ func (p *GoldenPath) KillSingBox(ctx context.Context) error {
531531
_ = cmd.Run() // kill 可能返回非 0 如果 sing-box 已死,不视为错
532532

533533
// 等待容器在 ≤3s 内退出(entrypoint fail-closed)
534-
deadline := time.Now().Add(3 * time.Second)
535-
for time.Now().Before(deadline) {
534+
err = harness.WaitFor(ctx, "container_exit:"+name, func(_ context.Context) error {
536535
var inspectOut bytes.Buffer
537536
insp := exec.CommandContext(ctx, "docker", "inspect", "-f", "{{.State.Running}}", name)
538537
insp.Stdout = &inspectOut
@@ -542,9 +541,12 @@ func (p *GoldenPath) KillSingBox(ctx context.Context) error {
542541
if strings.TrimSpace(inspectOut.String()) != "true" {
543542
return nil // 容器已退出
544543
}
545-
time.Sleep(200 * time.Millisecond)
544+
return fmt.Errorf("container %s still running", name)
545+
}, harness.WithTimeout(3*time.Second), harness.WithPollInterval(200*time.Millisecond))
546+
if err != nil {
547+
return fmt.Errorf("kill sing-box: container %s still running after 3s (entrypoint fail-closed violation)", name)
546548
}
547-
return fmt.Errorf("kill sing-box: container %s still running after 3s (entrypoint fail-closed violation)", name)
549+
return nil
548550
}
549551

550552
// ProbeOutboundFromUser 在 worker 容器内跑 `curl -sS --max-time <N> <url>`,

0 commit comments

Comments
 (0)