You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by ma...@apache.org on 2026/08/04 10:57:34 UTC

(yunikorn-core) branch master updated: [YUNIKORN-3320] Add test for required node reservation not cancelled on timeout (#1113)

This is an automated email from the ASF dual-hosted git repository.

manirajv06 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new c17e1ba6 [YUNIKORN-3320] Add test for required node reservation not cancelled on timeout (#1113)
c17e1ba6 is described below

commit c17e1ba60d3fdc813ebd7366181c2656e7494ae3
Author: kaijaytu <ka...@gmail.com>
AuthorDate: Tue Aug 4 16:27:26 2026 +0530

    [YUNIKORN-3320] Add test for required node reservation not cancelled on timeout (#1113)
    
    Closes: #1113
    
    Signed-off-by: mani <ma...@gmail.com>
---
 pkg/scheduler/objects/application_test.go | 41 +++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/pkg/scheduler/objects/application_test.go b/pkg/scheduler/objects/application_test.go
index 0f237df6..70db068f 100644
--- a/pkg/scheduler/objects/application_test.go
+++ b/pkg/scheduler/objects/application_test.go
@@ -3340,6 +3340,47 @@ func TestTryAllocateWithReservedHeadRoomChecking(t *testing.T) {
 	// reset wait timeout
 }
 
+// TestTryReservedAllocateRequiredNodeNotCancelledOnTimeout verifies that required node reservations
+// are not cancelled even if they exceed the reservationWaitTimeout.
+func TestTryReservedAllocateRequiredNodeNotCancelledOnTimeout(t *testing.T) {
+	setupUGM()
+
+	res, err := resources.NewResourceFromConf(map[string]string{"memory": "2G"})
+	assert.NilError(t, err, "failed to create basic resource")
+	headRoom, err := resources.NewResourceFromConf(map[string]string{"memory": "1G"})
+	assert.NilError(t, err, "failed to create basic resource")
+
+	app := newApplication(appID1, "default", "root")
+	ask := newAllocationAsk(aKey, appID1, res)
+	ask.SetRequiredNode(nodeID1)
+	queue, err := createRootQueue(map[string]string{"memory": "1G"})
+	assert.NilError(t, err, "queue create failed")
+	app.queue = queue
+	err = app.AddAllocationAsk(ask)
+	assert.NilError(t, err, "ask should have been added to app")
+
+	node1 := newNodeRes(nodeID1, res)
+	node2 := newNodeRes(nodeID2, res)
+	// reserve on the required node
+	err = app.Reserve(node1, ask)
+	assert.NilError(t, err, "reservation should not have failed")
+
+	iter := getNodeIteratorFn(node1, node2)
+
+	// headroom is insufficient, but reservation should NOT be cancelled (required node)
+	result := app.tryReservedAllocate(headRoom, iter)
+	assert.Assert(t, result == nil, "result is expected to be nil due to insufficient headroom")
+	assert.Equal(t, len(app.reservations), 1, "required node reservation should not be cancelled")
+
+	// set the reservation time to well beyond the timeout
+	app.reservations[ask.allocationKey].createTime = time.Now().Add(-90 * time.Minute)
+
+	// even after timeout, required node reservation must NOT be cancelled
+	result = app.tryReservedAllocate(headRoom, iter)
+	assert.Assert(t, result == nil, "result is expected to be nil due to insufficient headroom")
+	assert.Equal(t, len(app.reservations), 1, "required node reservation must not be cancelled on timeout")
+}
+
 func TestUpdateRunnableStatus(t *testing.T) {
 	app := newApplication(appID0, "default", "root.unknown")
 	assert.Assert(t, app.runnableInQueue)


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org