|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +suite: sandbox UID and GID |
| 5 | +templates: |
| 6 | + - templates/gateway-config.yaml |
| 7 | +release: |
| 8 | + name: openshell |
| 9 | + namespace: my-namespace |
| 10 | + |
| 11 | +tests: |
| 12 | + - it: omits sandbox_uid and sandbox_gid by default |
| 13 | + asserts: |
| 14 | + - notMatchRegex: |
| 15 | + path: data["gateway.toml"] |
| 16 | + pattern: 'sandbox_uid|sandbox_gid' |
| 17 | + |
| 18 | + - it: renders sandbox_uid and sandbox_gid as integers |
| 19 | + set: |
| 20 | + server.sandboxUid: 1500 |
| 21 | + server.sandboxGid: 2000 |
| 22 | + asserts: |
| 23 | + - matchRegex: |
| 24 | + path: data["gateway.toml"] |
| 25 | + pattern: '(?m)^\s*sandbox_uid\s*=\s*1500$' |
| 26 | + - matchRegex: |
| 27 | + path: data["gateway.toml"] |
| 28 | + pattern: '(?m)^\s*sandbox_gid\s*=\s*2000$' |
| 29 | + |
| 30 | + - it: renders sandbox_uid alone |
| 31 | + set: |
| 32 | + server.sandboxUid: 1500 |
| 33 | + asserts: |
| 34 | + - matchRegex: |
| 35 | + path: data["gateway.toml"] |
| 36 | + pattern: '(?m)^\s*sandbox_uid\s*=\s*1500$' |
| 37 | + - notMatchRegex: |
| 38 | + path: data["gateway.toml"] |
| 39 | + pattern: 'sandbox_gid' |
| 40 | + |
| 41 | + - it: renders large IDs without scientific notation |
| 42 | + set: |
| 43 | + server.sandboxUid: 1000680000 |
| 44 | + server.sandboxGid: 4294967294 |
| 45 | + asserts: |
| 46 | + - matchRegex: |
| 47 | + path: data["gateway.toml"] |
| 48 | + pattern: '(?m)^\s*sandbox_uid\s*=\s*1000680000$' |
| 49 | + - matchRegex: |
| 50 | + path: data["gateway.toml"] |
| 51 | + pattern: '(?m)^\s*sandbox_gid\s*=\s*4294967294$' |
| 52 | + |
| 53 | + - it: rejects a zero sandbox UID |
| 54 | + set: |
| 55 | + server.sandboxUid: 0 |
| 56 | + asserts: |
| 57 | + - failedTemplate: |
| 58 | + errorPattern: "server.sandboxUid must be an integer between 1 and 4294967294" |
| 59 | + |
| 60 | + - it: rejects a sandbox GID above the allowed range |
| 61 | + set: |
| 62 | + server.sandboxGid: 4294967295 |
| 63 | + asserts: |
| 64 | + - failedTemplate: |
| 65 | + errorPattern: "server.sandboxGid must be an integer between 1 and 4294967294" |
| 66 | + |
| 67 | + - it: rejects a non-numeric sandbox UID |
| 68 | + set: |
| 69 | + server.sandboxUid: abc |
| 70 | + asserts: |
| 71 | + - failedTemplate: |
| 72 | + errorPattern: "server.sandboxUid must be an integer between 1 and 4294967294" |
| 73 | + |
| 74 | + - it: rejects a fractional sandbox UID |
| 75 | + set: |
| 76 | + server.sandboxUid: 1500.5 |
| 77 | + asserts: |
| 78 | + - failedTemplate: |
| 79 | + errorPattern: "server.sandboxUid must be an integer between 1 and 4294967294" |
| 80 | + |
| 81 | + - it: rejects a boolean sandbox UID |
| 82 | + set: |
| 83 | + server.sandboxUid: true |
| 84 | + asserts: |
| 85 | + - failedTemplate: |
| 86 | + errorPattern: "server.sandboxUid must be an integer between 1 and 4294967294" |
| 87 | + |
| 88 | + - it: rejects a boolean sandbox GID |
| 89 | + set: |
| 90 | + server.sandboxGid: true |
| 91 | + asserts: |
| 92 | + - failedTemplate: |
| 93 | + errorPattern: "server.sandboxGid must be an integer between 1 and 4294967294" |
0 commit comments