Skip to content

Commit

Permalink
scheduler: fix elastic quota TestPlugin_OnPodDelete random panic
Browse files Browse the repository at this point in the history
Signed-off-by: xingbao.zy <xingbao.zy@alibaba-inc.com>
  • Loading branch information
xingbao.zy committed Jun 6, 2024
1 parent 1bac4d3 commit fa07c43
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/scheduler/plugins/elasticquota/pod_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

"github.com/koordinator-sh/koordinator/apis/extension"
koordfeatures "github.com/koordinator-sh/koordinator/pkg/features"
"github.com/koordinator-sh/koordinator/pkg/scheduler/plugins/elasticquota/core"
utilfeature "github.com/koordinator-sh/koordinator/pkg/util/feature"
)

Expand Down Expand Up @@ -184,9 +185,14 @@ func TestPlugin_OnPodDelete(t *testing.T) {

suit.AddQuota("test", "", 10, 40, 10, 40, 10, 40, false, "")

testQuotaInfo := plugin.groupQuotaManager.GetQuotaInfoByName("test")

assert.True(t, quotav1.Equals(testQuotaInfo.GetUsed(), v1.ResourceList{}))
var testQuotaInfo *core.QuotaInfo
for {
testQuotaInfo = plugin.groupQuotaManager.GetQuotaInfoByName("test")
if testQuotaInfo != nil {
assert.True(t, quotav1.Equals(testQuotaInfo.GetUsed(), v1.ResourceList{}))
break
}
}

pod := makePod2("pod", MakeResourceList().CPU(1).Mem(2).Obj())
pod.Labels[extension.LabelQuotaName] = "test"
Expand Down

0 comments on commit fa07c43

Please sign in to comment.