Skip to content

Commit

Permalink
FIx deepsource
Browse files Browse the repository at this point in the history
  • Loading branch information
ykadowak committed Mar 8, 2024
1 parent 9cef4fe commit 125e0c2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/config/index_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
package config

// IndexCreation represents the configurations for index creation.
// IndexOperator represents the configurations for index k8s operator.
type IndexOperator struct {
// AgentName represent agents meta_name for service discovery
AgentName string `json:"agent_name" yaml:"agent_name"`
Expand Down
10 changes: 3 additions & 7 deletions internal/k8s/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (c *client) Watch(ctx context.Context, obj cli.ObjectList, opts ...ListOpti
return c.withWatch.Watch(ctx, obj, opts...)
}

func (c *client) MatchingLabels(labels map[string]string) cli.MatchingLabels {
func (*client) MatchingLabels(labels map[string]string) cli.MatchingLabels {
return cli.MatchingLabels(labels)

Check warning on line 181 in internal/k8s/client/client.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/client/client.go#L180-L181

Added lines #L180 - L181 were not covered by tests
}

Expand Down Expand Up @@ -259,12 +259,8 @@ func (s *patcher) ApplyPodAnnotations(ctx context.Context, name, namespace strin
}

patch := &unstructured.Unstructured{Object: obj}
if err := s.client.Patch(ctx, patch, cli.Apply, &cli.PatchOptions{
return s.client.Patch(ctx, patch, cli.Apply, &cli.PatchOptions{

Check warning on line 262 in internal/k8s/client/client.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/client/client.go#L262

Added line #L262 was not covered by tests
FieldManager: s.fieldManager,
Force: ptr.To(true),
}); err != nil {
return err
}

return nil
})

Check warning on line 265 in internal/k8s/client/client.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/client/client.go#L265

Added line #L265 was not covered by tests
}
3 changes: 2 additions & 1 deletion internal/k8s/pod/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ func (r *reconciler) Reconcile(ctx context.Context, _ reconcile.Request) (res re
pods = make(map[string][]Pod, len(ps.Items))
)

for _, pod := range ps.Items {
for i := range ps.Items {
pod := ps.Items[i]

Check warning on line 115 in internal/k8s/pod/pod.go

View check run for this annotation

Codecov / codecov/patch

internal/k8s/pod/pod.go#L114-L115

Added lines #L114 - L115 were not covered by tests
if pod.GetObjectMeta().GetDeletionTimestamp() != nil ||
(r.namespace != "" && !strings.EqualFold(pod.GetNamespace(), r.namespace)) ||
pod.Status.Phase != corev1.PodRunning {
Expand Down
2 changes: 1 addition & 1 deletion internal/test/mock/k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type ValdK8sClientMock struct {

var _ client.Client = (*ValdK8sClientMock)(nil)

func (m *ValdK8sClientMock) Get(ctx context.Context, name string, namespace string, obj client.Object, opts ...crclient.GetOption) error {
func (m *ValdK8sClientMock) Get(ctx context.Context, name, namespace string, obj client.Object, opts ...crclient.GetOption) error {

Check warning on line 33 in internal/test/mock/k8s/client.go

View check run for this annotation

Codecov / codecov/patch

internal/test/mock/k8s/client.go#L33

Added line #L33 was not covered by tests
args := m.Called(ctx, name, namespace, obj, opts)
return args.Error(0)
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/index/operator/service/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ func (o *operator) podOnReconcile(ctx context.Context, podList map[string][]pod.
}

// TODO: implement job reconcile logic to detect save job completion and to start rotation.
func (o *operator) jobOnReconcile(ctx context.Context, jobList map[string][]job.Job) {
func (*operator) jobOnReconcile(_ context.Context, jobList map[string][]job.Job) {

Check warning on line 156 in pkg/index/operator/service/operator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/operator/service/operator.go#L156

Added line #L156 was not covered by tests
for k, v := range jobList {
for _, job := range v {
for i := range v {
job := v[i]

Check warning on line 159 in pkg/index/operator/service/operator.go

View check run for this annotation

Codecov / codecov/patch

pkg/index/operator/service/operator.go#L158-L159

Added lines #L158 - L159 were not covered by tests
log.Debug("key", k, "name:", job.Name, "status:", job.Status)
}
}
Expand Down

0 comments on commit 125e0c2

Please sign in to comment.