测试:345 个集成测试因内核缺失而失败 / 345 integration tests fail due to missing kernel
- Dominant language
- Swift
- Stars
- 49.9k
- Forks
- 1.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 22
Description
## 问题描述 / Problem
Running `swift test` results in 345 test failures, all caused by `.binaryNotFound` error. These failures are not code defects — they occur because the test environment lacks the required Linux kernel installation.
运行 `swift test` 会导致 345 个测试失败,均由 `.binaryNotFound` 错误引起。这些失败不是代码缺陷,而是测试环境缺少所需的 Linux 内核安装。
## 根本原因 / Root Cause
The `CLITest` base class (`Tests/CLITests/Utilities/CLITest.swift`) requires:
1. The `container` CLI binary at `bin/container`
2. A Linux kernel installed via `container system kernel set --recommended`
3. The container system service running (`container system start`)
Most integration tests (kernel set, container lifecycle, build, network, volumes, etc.) depend on these prerequisites.
## 受影响的测试 / Affected Tests
All 345 failures span ~15 test suites including:
- `TestCLIKernelSet` — directly tests kernel operations
- `TestCLIRunCommand1/2/3`, `TestCLIRunBase`, `TestCLIRunLifecycle` — container run
- `TestCLIExecCommand`, `TestCLICreateCommand` — container management
- `TestCLIBuildBase` — image building
- `TestCLIImagesCommand`, `TestCLIRegistry` — image management
- `TestCLIPruneCommand`, `TestCLIStatsCommand` — container operations
- `TestCLIVolumes`, `TestCLIAnonymousVolumes` — volume management
- `TestCLINetwork`, `TestCLIMachineCommand`, `TestCLIMachineRuntime` — networks and machines
## 修复方案 / Fix
PR #1728 provides:
- `scripts/setup-test-env.sh` — automated test environment setup
- `docs/testing.md` — comprehensive testing guide
- Makefile improvements — `setup-test-env` and `integration-test` targets
## 临时解决方法 / Workaround
```bash
# Manual setup:
make cli
container system start # Answer "y" when prompted for kernel install
swift test
```
Contributor guide
Research direction
Start with Tests/CLITests/Utilities/CLITest.swift and review the prerequisites for the affected integration suites. Then inspect scripts/setup-test-env.sh, docs/testing.md, and the Makefile changes described in PR #1728. Done means the test environment can be set up reproducibly and swift test no longer produces these environment-caused failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, shell, swift
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100