Skip to content

Commit de46f3a

Browse files
committed
Configurable data layer in tests
Signed-off-by: irar2 <irar@il.ibm.com>
1 parent 174ba30 commit de46f3a

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

pkg/epp/requestcontrol/director_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -652,27 +652,27 @@ func TestDirector_HandleRequest(t *testing.T) {
652652
}
653653

654654
for _, test := range tests {
655-
t.Run(test.name, func(t *testing.T) {
656-
mockSched := &mockScheduler{}
657-
if test.schedulerMockSetup != nil {
658-
test.schedulerMockSetup(mockSched)
659-
}
660-
config := NewConfig()
661-
if test.prepareDataPlugin != nil {
662-
config = config.WithPrepareDataPlugins(test.prepareDataPlugin)
663-
}
664-
config = config.WithAdmissionPlugins(newMockAdmissionPlugin("test-admit-plugin", test.admitRequestDenialError))
665-
666-
locator := NewCachedPodLocator(context.Background(), NewDatastorePodLocator(ds), time.Minute)
667-
director := NewDirectorWithConfig(ds, mockSched, test.mockAdmissionController, locator, config)
668-
if test.name == "successful request with model rewrite" {
669-
mockDs := &mockDatastore{
670-
pods: ds.PodList(datastore.AllPodsPredicate),
671-
rewrites: []*v1alpha2.InferenceModelRewrite{rewrite},
672-
}
673-
director.datastore = mockDs
674-
director.podLocator = NewCachedPodLocator(context.Background(), NewDatastorePodLocator(mockDs), time.Minute)
675-
}
655+
t.Run(test.name, func(t *testing.T) {
656+
mockSched := &mockScheduler{}
657+
if test.schedulerMockSetup != nil {
658+
test.schedulerMockSetup(mockSched)
659+
}
660+
config := NewConfig()
661+
if test.prepareDataPlugin != nil {
662+
config = config.WithPrepareDataPlugins(test.prepareDataPlugin)
663+
}
664+
config = config.WithAdmissionPlugins(newMockAdmissionPlugin("test-admit-plugin", test.admitRequestDenialError))
665+
666+
locator := NewCachedPodLocator(context.Background(), NewDatastorePodLocator(ds), time.Minute)
667+
director := NewDirectorWithConfig(ds, mockSched, test.mockAdmissionController, locator, config)
668+
if test.name == "successful request with model rewrite" {
669+
mockDs := &mockDatastore{
670+
pods: ds.PodList(datastore.AllPodsPredicate),
671+
rewrites: []*v1alpha2.InferenceModelRewrite{rewrite},
672+
}
673+
director.datastore = mockDs
674+
director.podLocator = NewCachedPodLocator(context.Background(), NewDatastorePodLocator(mockDs), time.Minute)
675+
}
676676
reqCtx := &handlers.RequestContext{
677677
Request: &handlers.Request{
678678
// Create a copy of the map for each test run to avoid mutation issues.

0 commit comments

Comments
 (0)