@@ -188,14 +188,14 @@ func Test_IsJobContainer(t *testing.T) {
188188 expected : false ,
189189 },
190190 {
191- name : "WCOW Hyper-V isolated with HostProcess=true (not a JobContainer) " ,
191+ name : "WCOW Hyper-V isolated with HostProcess=true" ,
192192 spec : & specs.Spec {
193193 Windows : & specs.Windows {
194194 HyperV : & specs.WindowsHyperV {},
195195 },
196196 Annotations : map [string ]string {annotations .HostProcessContainer : "true" },
197197 },
198- expected : false ,
198+ expected : true ,
199199 },
200200 {
201201 name : "LCOW without Windows (not a JobContainer)" ,
@@ -218,77 +218,11 @@ func Test_IsJobContainer(t *testing.T) {
218218}
219219
220220// -----------------------------------------------------------------------------
221- // IsIsolatedJobContainer tests
222- // -----------------------------------------------------------------------------
223-
224- func Test_IsIsolatedJobContainer (t * testing.T ) {
225- tests := []struct {
226- name string
227- spec * specs.Spec
228- expected bool
229- }{
230- {
231- name : "WCOW Hyper-V isolated with HostProcess=true" ,
232- spec : & specs.Spec {
233- Windows : & specs.Windows {
234- HyperV : & specs.WindowsHyperV {},
235- },
236- Annotations : map [string ]string {annotations .HostProcessContainer : "true" },
237- },
238- expected : true ,
239- },
240- {
241- name : "WCOW Hyper-V isolated with HostProcess=false" ,
242- spec : & specs.Spec {
243- Windows : & specs.Windows {
244- HyperV : & specs.WindowsHyperV {},
245- },
246- Annotations : map [string ]string {annotations .HostProcessContainer : "false" },
247- },
248- expected : false ,
249- },
250- {
251- name : "WCOW Hyper-V isolated with HostProcess missing" ,
252- spec : & specs.Spec {
253- Windows : & specs.Windows {
254- HyperV : & specs.WindowsHyperV {},
255- },
256- },
257- expected : false ,
258- },
259- {
260- name : "WCOW process-isolated with HostProcess=true (not isolated job)" ,
261- spec : & specs.Spec {
262- Windows : & specs.Windows {},
263- Annotations : map [string ]string {annotations .HostProcessContainer : "true" },
264- },
265- expected : false ,
266- },
267- {
268- name : "LCOW without Windows (not an isolated job container)" ,
269- spec : & specs.Spec {
270- Linux : & specs.Linux {},
271- },
272- expected : false ,
273- },
274- }
275-
276- for _ , tt := range tests {
277- tt := tt
278- t .Run (tt .name , func (t * testing.T ) {
279- actual := IsIsolatedJobContainer (tt .spec )
280- if actual != tt .expected {
281- t .Fatalf ("IsIsolatedJobContainer() = %v, expected %v" , actual , tt .expected )
282- }
283- })
284- }
285- }
286-
287- // -----------------------------------------------------------------------------
288- // Cross-property tests (consistency / mutual exclusivity)
221+ // Cross-property tests: IsJobContainer combined with IsIsolated to differentiate
222+ // process-isolated HPC from hypervisor-isolated HPC.
289223// -----------------------------------------------------------------------------
290224
291- func Test_JobContainer_And_IsolatedJobContainer_MutualExclusion (t * testing.T ) {
225+ func Test_JobContainer_IsolationDifferentiation (t * testing.T ) {
292226 // Process-isolated WCOW HostProcess=true
293227 processJob := & specs.Spec {
294228 Windows : & specs.Windows {},
@@ -297,8 +231,8 @@ func Test_JobContainer_And_IsolatedJobContainer_MutualExclusion(t *testing.T) {
297231 if ! IsJobContainer (processJob ) {
298232 t .Fatal ("expected IsJobContainer to be true for process-isolated HostProcess=true" )
299233 }
300- if IsIsolatedJobContainer (processJob ) {
301- t .Fatal ("expected IsIsolatedJobContainer to be false for process-isolated HostProcess=true" )
234+ if IsIsolated (processJob ) {
235+ t .Fatal ("expected IsIsolated to be false for process-isolated HostProcess=true" )
302236 }
303237
304238 // Hyper-V isolated WCOW HostProcess=true
@@ -308,10 +242,10 @@ func Test_JobContainer_And_IsolatedJobContainer_MutualExclusion(t *testing.T) {
308242 },
309243 Annotations : map [string ]string {annotations .HostProcessContainer : "true" },
310244 }
311- if IsJobContainer (hyperVJob ) {
312- t .Fatal ("expected IsJobContainer to be false for Hyper-V isolated HostProcess=true" )
245+ if ! IsJobContainer (hyperVJob ) {
246+ t .Fatal ("expected IsJobContainer to be true for Hyper-V isolated HostProcess=true" )
313247 }
314- if ! IsIsolatedJobContainer (hyperVJob ) {
315- t .Fatal ("expected IsIsolatedJobContainer to be true for Hyper-V isolated HostProcess=true" )
248+ if ! IsIsolated (hyperVJob ) {
249+ t .Fatal ("expected IsIsolated to be true for Hyper-V isolated HostProcess=true" )
316250 }
317251}
0 commit comments