Skip to content

Commit

Permalink
fix go lint test error,change fl_selector into flSelector
Browse files Browse the repository at this point in the history
Signed-off-by: SherlockShemol <[email protected]>
  • Loading branch information
SherlockShemol committed Oct 19, 2024
1 parent e225c3f commit 4dfff98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type Controller struct {
// map to record the pods that are recreated
recreatedPods sync.Map

fl_selector labels.Selector
flSelector labels.Selector

aggServiceHost string

Expand Down Expand Up @@ -325,8 +325,8 @@ func (c *Controller) sync(key string) (bool, error) {
return true, nil
}

c.fl_selector, _ = runtime.GenerateSelector(&job)
pods, err := c.podStore.Pods(job.Namespace).List(c.fl_selector)
c.flSelector, _ = runtime.GenerateSelector(&job)
pods, err := c.podStore.Pods(job.Namespace).List(c.flSelector)
if err != nil {
return false, err
}
Expand Down Expand Up @@ -766,7 +766,7 @@ func (c *Controller) updateJob(old, cur interface{}) {
}

if oldJob.Generation != curJob.Generation {
pods, err := c.podStore.Pods(curJob.Namespace).List(c.fl_selector)
pods, err := c.podStore.Pods(curJob.Namespace).List(c.flSelector)
if err != nil {
klog.Errorf("Failed to list pods: %v", err)
}
Expand Down Expand Up @@ -806,4 +806,4 @@ func (c *Controller) createService(job *sednav1.FederatedLearningJob) (err error
return err
}
return nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,13 @@ func Test_updateJob(t *testing.T) {
eventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: fakeKubeClient.CoreV1().Events("")})
// Create a controller with the fake clients
c := &Controller{
kubeClient: fakeKubeClient,
client: fakeSednaClient.SednaV1alpha1(),
podStore: &mockPodLister{pods: testPods},
fl_selector: labels.SelectorFromSet(labels.Set{"federatedlearningjob.sedna.io/job-name": "test-fl-job"}),
queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(runtime.DefaultBackOff, runtime.MaxBackOff), "test-fl-job"),
recorder: eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "test-fl-job"}),
cfg: cfg,
kubeClient: fakeKubeClient,
client: fakeSednaClient.SednaV1alpha1(),
podStore: &mockPodLister{pods: testPods},
flSelector: labels.SelectorFromSet(labels.Set{"federatedlearningjob.sedna.io/job-name": "test-fl-job"}),
queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(runtime.DefaultBackOff, runtime.MaxBackOff), "test-fl-job"),
recorder: eventBroadcaster.NewRecorder(scheme.Scheme, v1.EventSource{Component: "test-fl-job"}),
cfg: cfg,
sendToEdgeFunc: func(nodeName string, eventType watch.EventType, job interface{}) error {
return nil
},
Expand Down

0 comments on commit 4dfff98

Please sign in to comment.