Skip to content

Commit 69c137a

Browse files
committed
website: add guide for testing
As required by <https://www.bestpractices.dev/en/projects/6505>: > Quality > [...] > New functionality testing > > - The project MUST have a general policy (formal or not) that as major > new functionality is added to the software produced by the project, > tests of that functionality should be added to an automated test > suite. > > - The project MUST have evidence that the test_policy for adding tests > has been adhered to in the most recent major changes to the software > produced by the project. > > - It is SUGGESTED that this policy on adding tests (see test_policy) be > documented in the instructions for change proposals. Signed-off-by: Akihiro Suda <[email protected]>
1 parent 0cbf6ab commit 69c137a

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

website/content/en/docs/Community/Contributing/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ See also <https://github.com/cncf/foundation/blob/main/allowed-third-party-licen
2121

2222
Pull requests can be submitted to <https://github.com/lima-vm/lima/pulls>.
2323

24+
It is highly suggested to add [tests](../../dev/testing/) for every non-trivial pull requests.
25+
A test can be implemented as a unit test rather than an integration test when it is possible,
26+
to avoid slowing the integration test CI.
27+
2428
## Merging pull requests
2529

2630
[Committers](../governance) can merge pull requests.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Testing
3+
weight: 20
4+
---
5+
6+
## Unit tests
7+
8+
The unit tests are written in Go and can be executed with the following commands:
9+
10+
```bash
11+
go test -v ./...
12+
```
13+
14+
The unit tests do not execute actual virtual machines.
15+
16+
## Integration tests
17+
18+
The integration tests incurs actual execution of virtual machines.
19+
20+
The integration tests are written in bash and partially in Perl.
21+
22+
Use [`hack/test-templates.sh`](https://github.com/lima-vm/lima/blob/master/hack/test-templates.sh)
23+
to execute integration tests, with a virtual machine template file, e.g.,:
24+
25+
```bash
26+
./hack/test-templates.sh ./templates/default.yaml
27+
./hack/test-templates.sh ./templates/fedora.yaml
28+
./hack/test-templates.sh ./hack/test-templates/test-misc.yaml
29+
```
30+
31+
## CI
32+
33+
[`.github/workflows/test.yml`](https://github.com/lima-vm/lima/blob/master/.github/workflows/test.yml)
34+
executes the unit tests and the integration tests on the GitHub Actions with the ["Tier 1"](../../templates/) templates.
35+
36+
Most integration tests are executed on Linux runners, as macOS runners are slow and flaky.
37+
38+
The tests about macOS-specific features (e.g., vz and vmnet) are still executed on macOS runners.
39+
40+
Currently, the Intel version of macOS is used, as the ARM version of macOS on GitHub Actions still
41+
do not support nested virtualization.

0 commit comments

Comments
 (0)