Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sakoush committed Sep 30, 2024
1 parent ec84b3a commit 16ac4fd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
8 changes: 4 additions & 4 deletions operator/scheduler/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestSubscribeModelEvents(t *testing.T) {
Generation: 1,
},
State: &scheduler.ModelStatus{
State: scheduler.ModelStatus_ModelAvailable,
State: scheduler.ModelStatus_ModelAvailable,
AvailableReplicas: 1,
},
},
Expand Down Expand Up @@ -92,8 +92,8 @@ func TestSubscribeModelEvents(t *testing.T) {
Generation: 1,
},
State: &scheduler.ModelStatus{
State: scheduler.ModelStatus_ModelProgressing,
AvailableReplicas: 0,
State: scheduler.ModelStatus_ModelProgressing,
AvailableReplicas: 0,
UnavailableReplicas: 1,
},
},
Expand Down Expand Up @@ -160,7 +160,7 @@ func TestSubscribeModelEvents(t *testing.T) {
Generation: 1,
},
State: &scheduler.ModelStatus{
State: scheduler.ModelStatus_ModelTerminating,
State: scheduler.ModelStatus_ModelTerminating,
AvailableReplicas: 1,
},
},
Expand Down
2 changes: 1 addition & 1 deletion operator/scheduler/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestSubscribeServerEvents(t *testing.T) {
noSchedulerState bool
}

// note expected state is derived in the test, maybe we should be explict about it in the future
// note expected state is derived in the test, maybe we should be explicit about it in the future
tests := []test{
{
// no scheduler state means lost servers metadata
Expand Down
4 changes: 2 additions & 2 deletions operator/scheduler/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func getNumPipelinesFromScheduler(ctx context.Context, grpcClient scheduler.Sche
}

func (s *SchedulerClient) handleExperiments(
ctx context.Context, grpcClient scheduler.SchedulerClient, namespace string,) error {
ctx context.Context, grpcClient scheduler.SchedulerClient, namespace string) error {
// get experiments from the scheduler
// if there are no experiments in the scheduler state then we need to create them
// this is likely because of a restart of the scheduler that migrated the state
Expand All @@ -339,7 +339,7 @@ func (s *SchedulerClient) handleExperiments(
}

func (s *SchedulerClient) handlePipelines(
ctx context.Context, grpcClient scheduler.SchedulerClient, namespace string, ) error {
ctx context.Context, grpcClient scheduler.SchedulerClient, namespace string) error {
// get pipelines from the scheduler
// if there are no pipelines in the scheduler state then we need to create them
// this is likely because of a restart of the scheduler that migrated the state
Expand Down
27 changes: 17 additions & 10 deletions operator/scheduler/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ func TestHandleLoadedExperiments(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
grpcClient := mockSchedulerGrpcClient{}
client := newMockControllerClient(test.resources...)
client.handleLoadedExperiments(context.Background(), &grpcClient, "")
err := client.handleLoadedExperiments(context.Background(), &grpcClient, "")
g.Expect(err).To(BeNil())
activeResources := 0
// TODO check the entire object
for idx, req := range test.resources {
Expand Down Expand Up @@ -402,7 +403,8 @@ func TestHandleLoadedModels(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
grpcClient := mockSchedulerGrpcClient{}
client := newMockControllerClient(test.resources...)
client.handleLoadedModels(context.Background(), &grpcClient, "")
err := client.handleLoadedModels(context.Background(), &grpcClient, "")
g.Expect(err).To(BeNil())
activeResources := 0
// TODO check the entire object
for idx, req := range test.resources {
Expand Down Expand Up @@ -472,7 +474,8 @@ func TestHandleLoadedPipelines(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
grpcClient := mockSchedulerGrpcClient{}
client := newMockControllerClient(test.resources...)
client.handleLoadedPipelines(context.Background(), &grpcClient, "")
err := client.handleLoadedPipelines(context.Background(), &grpcClient, "")
g.Expect(err).To(BeNil())
activeResources := 0
// TODO check the entire object
for idx, req := range test.resources {
Expand Down Expand Up @@ -541,11 +544,12 @@ func TestHandleDeletedExperiments(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
s := newMockControllerClient(test.resources...)
s.handlePendingDeleteExperiments(context.Background(), "")
err := s.handlePendingDeleteExperiments(context.Background(), "")
g.Expect(err).To(BeNil())

actualResourcesList := &mlopsv1alpha1.ExperimentList{}
// Get all experiments in the namespace
err := s.List(
err = s.List(
context.Background(),
actualResourcesList,
client.InNamespace(""),
Expand Down Expand Up @@ -619,11 +623,12 @@ func TestHandleDeletedPipelines(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
s := newMockControllerClient(test.resources...)
s.handlePendingDeletePipelines(context.Background(), "")
err := s.handlePendingDeletePipelines(context.Background(), "")
g.Expect(err).To(BeNil())

actualResourcesList := &mlopsv1alpha1.PipelineList{}
// Get all pipelines in the namespace
err := s.List(
err = s.List(
context.Background(),
actualResourcesList,
client.InNamespace(""),
Expand Down Expand Up @@ -702,11 +707,12 @@ func TestHandleDeletedModels(t *testing.T) {
},
}
s := newMockControllerClient(test.resources...)
s.handlePendingDeleteModels(context.Background(), &grpcClient, "")
err := s.handlePendingDeleteModels(context.Background(), &grpcClient, "")
g.Expect(err).To(BeNil())

actualResourcesList := &mlopsv1alpha1.ModelList{}
// Get all models in the namespace
err := s.List(
err = s.List(
context.Background(),
actualResourcesList,
client.InNamespace(""),
Expand Down Expand Up @@ -804,7 +810,8 @@ func TestHandleRegisteredServers(t *testing.T) {
t.Run(test.name, func(t *testing.T) {
grpcClient := mockSchedulerGrpcClient{}
client := newMockControllerClient(test.resources...)
client.handleRegisteredServers(context.Background(), &grpcClient, "")
err := client.handleRegisteredServers(context.Background(), &grpcClient, "")
g.Expect(err).To(BeNil())
g.Expect(grpcClient.requests_servers).To(Equal(test.expected))
})
}
Expand Down

0 comments on commit 16ac4fd

Please sign in to comment.