@@ -343,7 +343,7 @@ var _ = ginkgo.Describe("Topology Aware Scheduling", ginkgo.Ordered, func() {
343343 gomega .Consistently (func (g gomega.Gomega ) {
344344 g .Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (wl ), wl )).To (gomega .Succeed ())
345345 g .Expect (workload .IsAdmitted (wl )).To (gomega .BeFalse ())
346- }, util .ConsistentDuration , util .Interval ).Should (gomega .Succeed ())
346+ }, util .ShortConsistentDuration , util .Interval ).Should (gomega .Succeed ())
347347 })
348348 })
349349
@@ -393,7 +393,7 @@ var _ = ginkgo.Describe("Topology Aware Scheduling", ginkgo.Ordered, func() {
393393 gomega .Consistently (func (g gomega.Gomega ) {
394394 g .Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (wl ), wl )).To (gomega .Succeed ())
395395 g .Expect (workload .IsAdmitted (wl )).To (gomega .BeFalse ())
396- }, util .ConsistentDuration , util .Interval ).Should (gomega .Succeed ())
396+ }, util .ShortConsistentDuration , util .Interval ).Should (gomega .Succeed ())
397397 })
398398
399399 ginkgo .By ("delete the non-TAS pod" , func () {
@@ -476,6 +476,59 @@ var _ = ginkgo.Describe("Topology Aware Scheduling", ginkgo.Ordered, func() {
476476 util .ExpectAdmittedWorkloadsTotalMetric (clusterQueue , "" , 2 )
477477 })
478478 })
479+
480+ ginkgo .It ("non-TAS pod terminating; capacity not released" , func () {
481+ var wl * kueue.Workload
482+ var nonTasPod * corev1.Pod
483+
484+ ginkgo .By ("create a non-TAS pod which consumes the node's capacity" , func () {
485+ nonTasPod = testingpod .MakePod ("pod" , ns .Name ).
486+ Request (corev1 .ResourceCPU , "1" ).
487+ NodeName ("node1" ).
488+ StatusPhase (corev1 .PodRunning ).
489+ Finalizer ("kueue.sigs.k8s.io/test-finalizer" ).
490+ Obj ()
491+ util .MustCreate (ctx , k8sClient , nonTasPod )
492+ })
493+
494+ ginkgo .By ("create a workload which requires the node's capacity" , func () {
495+ wl = utiltestingapi .MakeWorkload ("wl" , ns .Name ).
496+ Queue ("local-queue" ).
497+ Request (corev1 .ResourceCPU , "1" ).
498+ Obj ()
499+ util .MustCreate (ctx , k8sClient , wl )
500+
501+ ginkgo .By ("verify the workload is not admitted" , func () {
502+ util .ExpectPendingWorkloadsMetric (clusterQueue , 0 , 1 )
503+ util .ExpectWorkloadsToBePending (ctx , k8sClient , wl )
504+ gomega .Consistently (func (g gomega.Gomega ) {
505+ g .Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (wl ), wl )).To (gomega .Succeed ())
506+ g .Expect (workload .IsAdmitted (wl )).To (gomega .BeFalse ())
507+ }, util .ShortConsistentDuration , util .Interval ).Should (gomega .Succeed ())
508+ })
509+ })
510+
511+ ginkgo .By ("delete the non-TAS pod" , func () {
512+ gomega .Expect (k8sClient .Delete (ctx , nonTasPod )).To (gomega .Succeed ())
513+ })
514+
515+ ginkgo .By ("verify the non-TAS pod has deletionTimestamp" , func () {
516+ gomega .Eventually (func (g gomega.Gomega ) {
517+ g .Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (nonTasPod ), nonTasPod )).To (gomega .Succeed ())
518+ g .Expect (nonTasPod .DeletionTimestamp ).NotTo (gomega .BeNil ())
519+ }, util .Timeout , util .Interval ).Should (gomega .Succeed ())
520+ })
521+
522+ ginkgo .By ("Verify that the TAS-workload doesn't admit" , func () {
523+ gomega .Consistently (func (g gomega.Gomega ) {
524+ g .Expect (k8sClient .Get (ctx , client .ObjectKeyFromObject (wl ), wl )).To (gomega .Succeed ())
525+ g .Expect (workload .IsAdmitted (wl )).To (gomega .BeFalse ())
526+ }, util .ShortConsistentDuration , util .Interval ).Should (gomega .Succeed ())
527+ })
528+ // note to future developer: this non-TAS pod doesn't delete properly after ns clean-up,
529+ // so it will keep taking node1's capacity.
530+ // need to debug this before writing future tests.
531+ })
479532 })
480533
481534 ginkgo .When ("Single TAS Resource Flavor" , func () {
0 commit comments