chia7712 commented on code in PR #839:
URL: https://github.com/apache/yunikorn-k8shim/pull/839#discussion_r1599440861


##########
pkg/client/clients_test.go:
##########
@@ -0,0 +1,86 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you 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 client
+
+import (
+       "testing"
+       "time"
+
+       "gotest.tools/v3/assert"
+
+       "github.com/apache/yunikorn-core/pkg/common"
+       "github.com/apache/yunikorn-k8shim/pkg/common/test"
+)
+
+const (
+       noOfInformers = 9

Review Comment:
   Could you add comments for this magic number?



##########
pkg/client/apifactory_mock.go:
##########
@@ -416,38 +417,80 @@ func (m *MockedAPIProvider) GetBoundPods(clear bool) 
[]BoundPod {
 }
 
 // MockedPersistentVolumeInformer implements PersistentVolumeInformer interface
-type MockedPersistentVolumeInformer struct{}
+type MockedPersistentVolumeInformer struct {
+       informer cache.SharedIndexInformer
+}
+
+func NewMockedPersistentVolumeInformer() *MockedPersistentVolumeInformer {
+       return &MockedPersistentVolumeInformer{
+               informer: &test.SharedInformerMock{},
+       }
+}
 
 func (m *MockedPersistentVolumeInformer) Informer() cache.SharedIndexInformer {
-       return nil
+       return m.informer
 }
 
 func (m *MockedPersistentVolumeInformer) Lister() 
corev1.PersistentVolumeLister {
        return nil
 }
 
 // MockedPersistentVolumeClaimInformer implements 
PersistentVolumeClaimInformer interface
-type MockedPersistentVolumeClaimInformer struct{}
+type MockedPersistentVolumeClaimInformer struct {
+       informer cache.SharedIndexInformer
+}
+
+func NewMockedPersistentVolumeClaimInformer() 
*MockedPersistentVolumeClaimInformer {
+       return &MockedPersistentVolumeClaimInformer{
+               informer: &test.SharedInformerMock{},
+       }
+}
 
 func (m *MockedPersistentVolumeClaimInformer) Informer() 
cache.SharedIndexInformer {
-       return nil
+       return m.informer
 }
 
 func (m *MockedPersistentVolumeClaimInformer) Lister() 
corev1.PersistentVolumeClaimLister {
        return nil
 }
 
 // MockedStorageClassInformer implements StorageClassInformer interface
-type MockedStorageClassInformer struct{}
+type MockedStorageClassInformer struct {
+       informer cache.SharedIndexInformer
+}
+
+func NewMockedStorageClassInformer() *MockedStorageClassInformer {
+       return &MockedStorageClassInformer{
+               informer: &test.SharedInformerMock{},
+       }
+}
 
 func (m *MockedStorageClassInformer) Informer() cache.SharedIndexInformer {
-       return nil
+       return m.informer
 }
 
 func (m *MockedStorageClassInformer) Lister() storagev1.StorageClassLister {
        return nil
 }
 
+type MockedCSINodeInformer struct {
+       informer cache.SharedIndexInformer
+}
+
+func NewMockedCSINodeInformer() *MockedCSINodeInformer {
+       return &MockedCSINodeInformer{
+               informer: &test.SharedInformerMock{},
+       }
+}
+
+func (m *MockedCSINodeInformer) Informer() cache.SharedIndexInformer {
+       return &test.SharedInformerMock{}

Review Comment:
   maybe it should return `m.informer`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to