Skip to content

Commit 31572b9

Browse files
committed
Cover empty sandboxClasses and an empty entry name in WorkerPool validation tests
Add cases for an empty spec.sandboxClasses list and for an entry with an empty name, so both minItems and the name enum are exercised. Also point the ActorTemplate sandboxConfig field description at WorkerPool's sandboxClasses list, matching the rest of the guide.
1 parent a5142ec commit 31572b9

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎docs/api-guide.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ The `ActorTemplate` defines the code, environment, and state-management policies
121121
| Field | Type | Description |
122122
| :--- | :--- | :--- |
123123
| `containers` | `[]Container` | **Required.** The workload definition — see [Container Fields](#container-fields) below. Each container may also declare an optional `wakeupProbe` HTTP probe — see [Container Wakeup Probe](#container-wakeup-probe-wakeupprobe). |
124-
| `sandboxConfig` | `SandboxConfig` | **Required.** The sandbox runtime selection: `sandboxClass` (**required**, `SANDBOX_CLASS_GVISOR` or `SANDBOX_CLASS_MICROVM`) picks the runtime family this template's actors require — only `WorkerPool`s whose `sandboxClass` matches are eligible — and `configName` (**required**) names the cluster-scoped [`SandboxConfig`](#3-sandboxconfig-the-sandbox-itself) object supplying the sandbox binaries. It must reference an existing config of the matching class; `CreateActorTemplate` rejects the template otherwise. |
124+
| `sandboxConfig` | `SandboxConfig` | **Required.** The sandbox runtime selection: `sandboxClass` (**required**, `SANDBOX_CLASS_GVISOR` or `SANDBOX_CLASS_MICROVM`) picks the runtime family this template's actors require — only `WorkerPool`s whose `sandboxClasses` entry matches are eligible — and `configName` (**required**) names the cluster-scoped [`SandboxConfig`](#3-sandboxconfig-the-sandbox-itself) object supplying the sandbox binaries. It must reference an existing config of the matching class; `CreateActorTemplate` rejects the template otherwise. |
125125
| `workerSelector` | `*Selector` | Optional. Gates which `WorkerPool`s actors from this template may use, by matching against each pool's labels (`matchLabels`). If unset, all pools are eligible (subject to the actor's own `worker_selector`). |
126126
| `snapshotConfig` | `SnapshotConfig` | **Required.** The base object-storage location snapshots are written under, plus the snapshot scope (`onCommit`) used by both Pause and Suspend. See [Snapshot Storage Layout](#snapshot-storage-layout). |
127127
| `volumes` | `[]Volume` | Optional. Volumes the containers may mount, each a `durableDir`, an `externalVolumeTemplate` (see [CSI Volumes Guide](csi-volumes.md)), or a `systemInfo` volume (see [SystemInfo Volumes](#systeminfo-volumes)). Every declared volume must be mounted by at least one container. A `microvm` template may declare several `durableDir` volumes; a `gvisor` template is limited to one. |

‎pkg/api/v1alpha1/workerpool_validation_test.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ func TestWorkerPoolValidation(t *testing.T) {
7878
},
7979
wantErr: true,
8080
errMsg: "spec.sandboxClasses: Required value",
81+
}, {
82+
name: "empty sandboxClasses",
83+
mutate: func(wp *WorkerPool) {
84+
wp.Spec.SandboxClasses = []WorkerPoolSandboxClass{}
85+
},
86+
wantErr: true,
87+
errMsg: "spec.sandboxClasses",
88+
}, {
89+
name: "sandboxClass with empty name",
90+
mutate: func(wp *WorkerPool) {
91+
wp.Spec.SandboxClasses = []WorkerPoolSandboxClass{{}}
92+
},
93+
wantErr: true,
94+
errMsg: "spec.sandboxClasses[0].name",
8195
}, {
8296
name: "more than one sandboxClass",
8397
mutate: func(wp *WorkerPool) {

0 commit comments

Comments
 (0)