Skip to content

Commit b11cdff

Browse files
committed
Add tests for resource fungibility plugin
Signed-off-by: carlory <[email protected]>
1 parent 4ba4b0b commit b11cdff

File tree

3 files changed

+391
-40
lines changed

3 files changed

+391
-40
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module github.com/inftyai/scheduler
33
go 1.24.1
44

55
require (
6+
github.com/google/go-cmp v0.7.0
67
github.com/inftyai/llmaz v0.1.3
78
k8s.io/api v0.33.1
89
k8s.io/apimachinery v0.33.1
@@ -38,7 +39,6 @@ require (
3839
github.com/google/btree v1.1.3 // indirect
3940
github.com/google/cel-go v0.23.2 // indirect
4041
github.com/google/gnostic-models v0.6.9 // indirect
41-
github.com/google/go-cmp v0.7.0 // indirect
4242
github.com/google/uuid v1.6.0 // indirect
4343
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
4444
github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 // indirect

pkg/plugins/resource_fungibility/resource_fungibility.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ var (
5353
resource = "openmodels"
5454
)
5555

56-
// TODO: get the inference service to extract the flavors.
5756
type ResourceFungibility struct {
5857
handle framework.Handle
59-
dynClient *dynamic.DynamicClient
58+
dynClient dynamic.Interface
6059
}
6160

6261
type flavor struct {
@@ -172,6 +171,11 @@ func (rf *ResourceFungibility) calPreFilterState(ctx context.Context, pod *v1.Po
172171
}
173172
}
174173

174+
if len(serviceFlavors) == 0 {
175+
s.shouldSkip = true
176+
return nil
177+
}
178+
175179
for _, f := range serviceFlavors {
176180
if len(f.NodeSelector) == 0 {
177181
// Once nodeSelector is empty, which means all nodes are potential candidates,

0 commit comments

Comments
 (0)