|
| 1 | +# Copyright 2025 NVIDIA CORPORATION |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +suite: test nvFractions subchart gating and validation |
| 5 | + |
| 6 | +tests: |
| 7 | + - it: rejects nvFractions.set=true with a conflicting gpuSharingMode |
| 8 | + templates: |
| 9 | + - templates/validate.yaml |
| 10 | + set: |
| 11 | + global.nvFractions.set: true |
| 12 | + global.gpuSharingMode: HamiCore |
| 13 | + asserts: |
| 14 | + - failedTemplate: |
| 15 | + errorMessage: 'global.nvFractions.set=true requires global.gpuSharingMode to be empty or "NvFractions", got "HamiCore"' |
| 16 | + |
| 17 | + - it: allows nvFractions.set=true with an explicit NvFractions mode |
| 18 | + templates: |
| 19 | + - templates/validate.yaml |
| 20 | + set: |
| 21 | + global.nvFractions.set: true |
| 22 | + global.gpuSharingMode: NvFractions |
| 23 | + asserts: |
| 24 | + - notFailedTemplate: {} |
| 25 | + |
| 26 | + - it: allows nvFractions.set=true with an empty gpuSharingMode |
| 27 | + templates: |
| 28 | + - templates/validate.yaml |
| 29 | + set: |
| 30 | + global.nvFractions.set: true |
| 31 | + asserts: |
| 32 | + - notFailedTemplate: {} |
| 33 | + |
| 34 | + - it: allows gpuSharingMode NvFractions while the subchart is disabled |
| 35 | + templates: |
| 36 | + - templates/validate.yaml |
| 37 | + set: |
| 38 | + global.gpuSharingMode: NvFractions |
| 39 | + asserts: |
| 40 | + - notFailedTemplate: {} |
| 41 | + |
| 42 | + - it: nvFractions.set=true selects NvFractions and omits legacy gpuSharing |
| 43 | + templates: |
| 44 | + - kai-config.yaml |
| 45 | + set: |
| 46 | + kaiConfigDeployer.enabled: false |
| 47 | + kaiConfig.render: true |
| 48 | + global.nvFractions.set: true |
| 49 | + asserts: |
| 50 | + - equal: |
| 51 | + path: spec.global.gpuSharingMode |
| 52 | + value: NvFractions |
| 53 | + - notExists: |
| 54 | + path: spec.admission.gpuSharing |
| 55 | + |
| 56 | + - it: nvFractions.set=true is not downgraded by a legacy gpuSharing value |
| 57 | + templates: |
| 58 | + - kai-config.yaml |
| 59 | + set: |
| 60 | + kaiConfigDeployer.enabled: false |
| 61 | + kaiConfig.render: true |
| 62 | + global.nvFractions.set: true |
| 63 | + global.gpuSharing: false |
| 64 | + asserts: |
| 65 | + - equal: |
| 66 | + path: spec.global.gpuSharingMode |
| 67 | + value: NvFractions |
| 68 | + - notExists: |
| 69 | + path: spec.admission.gpuSharing |
| 70 | + |
| 71 | + - it: nvFractions.set=true with an explicit NvFractions mode agrees |
| 72 | + templates: |
| 73 | + - kai-config.yaml |
| 74 | + set: |
| 75 | + kaiConfigDeployer.enabled: false |
| 76 | + kaiConfig.render: true |
| 77 | + global.nvFractions.set: true |
| 78 | + global.gpuSharingMode: NvFractions |
| 79 | + asserts: |
| 80 | + - equal: |
| 81 | + path: spec.global.gpuSharingMode |
| 82 | + value: NvFractions |
| 83 | + |
| 84 | + - it: default is unchanged when nvFractions.set is false |
| 85 | + templates: |
| 86 | + - kai-config.yaml |
| 87 | + set: |
| 88 | + kaiConfigDeployer.enabled: false |
| 89 | + kaiConfig.render: true |
| 90 | + asserts: |
| 91 | + - equal: |
| 92 | + path: spec.global.gpuSharingMode |
| 93 | + value: NonMemoryEnforced |
| 94 | + |
| 95 | + # No mirror-image test asserting the deployment is absent when nvFractions.set is false: |
| 96 | + # helm-unittest treats a conditioned-out subchart template as "not exists or not selected" |
| 97 | + # and errors instead of rendering zero documents. The off state is covered by Helm's |
| 98 | + # condition: semantics and by the NonMemoryEnforced default asserted above. |
| 99 | + - it: renders the gpu-sharing operator deployment when nvFractions.set is true |
| 100 | + templates: |
| 101 | + - charts/gpu-sharing/templates/deployment.yaml |
| 102 | + set: |
| 103 | + global.nvFractions.set: true |
| 104 | + asserts: |
| 105 | + - hasDocuments: |
| 106 | + count: 1 |
| 107 | + - isKind: |
| 108 | + of: Deployment |
0 commit comments