Skip to content

Commit

Permalink
add e2e case for multi quota tree
Browse files Browse the repository at this point in the history
Signed-off-by: chuanyun.lcy <[email protected]>
  • Loading branch information
chuanyun.lcy committed Sep 21, 2023
1 parent 1d0df44 commit bf6ee05
Show file tree
Hide file tree
Showing 5 changed files with 519 additions and 1 deletion.
10 changes: 10 additions & 0 deletions apis/extension/elastic_quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,13 @@ func GetAllocated(quota *v1alpha1.ElasticQuota) (corev1.ResourceList, error) {
}
return allocated, nil
}

func GetRuntime(quota *v1alpha1.ElasticQuota) (corev1.ResourceList, error) {
runtime := corev1.ResourceList{}
if quota.Annotations[AnnotationRuntime] != "" {
if err := json.Unmarshal([]byte(quota.Annotations[AnnotationRuntime]), &runtime); err != nil {
return runtime, err
}
}
return runtime, nil
}
2 changes: 1 addition & 1 deletion pkg/webhook/elasticquota/quota_topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (qt *quotaTopology) ValidDeleteQuota(quota *v1alpha1.ElasticQuota) error {
return fmt.Errorf("failed list pods for quota %v, err: %v", quota.Name, err)
}
if len(podList.Items) > 0 {
return fmt.Errorf("delete quota failed, quota%v has child pods", quotaName)
return fmt.Errorf("delete quota failed, quota %v has child pods", quotaName)
}

delete(qt.quotaHierarchyInfo[quotaInfo.ParentName], quotaName)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/koordinator-sh/koordinator/test/utils/image"

// test sources
_ "github.com/koordinator-sh/koordinator/test/e2e/quota"
_ "github.com/koordinator-sh/koordinator/test/e2e/scheduling"
_ "github.com/koordinator-sh/koordinator/test/e2e/slocontroller"
)
Expand Down
24 changes: 24 additions & 0 deletions test/e2e/quota/framework.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright 2022 The Koordinator Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package quota

import "github.com/onsi/ginkgo"

// SIGDescribe describes SIG information
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[quota] "+text, body)
}
Loading

0 comments on commit bf6ee05

Please sign in to comment.